module ToyRobot
  class CLI
    def initialize(registry: nil)
      @robot = ToyRobot::Robot.new
      @registry = registry.nil? ? build_register : registry
    end

    def run
      while command = gets
        command = @registry.from command
        command.perform @robot
      end
    end

    def build_register
      registry = ToyRobot::Command::Registry.new
      registry.add ToyRobot::Command::Quit.new
      registry
    end
  end
end

module ToyRobot
  class CLI
    def initialize(registry: ToyRobot::Command::CLIRegistry.new)
      @robot = ToyRobot::Robot.new
      @registry = registry
    end

    def run
      while command = gets
        command = @registry.from command
        command.perform @robot
      end
    end
  end
end

Use the new CLI registry in the CLI app.
Use the new CLI registry in the CLI app.