Sha256: 6fdb5c241c7700a4607cca48c40589c09e8cb20b53d17b48610be1cb3b02d38d

Contents?: true

Size: 686 Bytes

Versions: 1

Compression:

Stored size: 686 Bytes

Contents

# typed: true
# frozen_string_literal: true

module MooTool
  # Abstract base command for all command types.
  class Command
    attr_reader :file, :controller, :action, :output_format, :remain

    def self.parse(args)
      Command.new args[2], :human, args[0], args[1], args[3..]
    end

    def initialize(file, _output_format, controller, action, remain)
      @file = file
      @controller = controller
      @output_format = :human
      @remain = remain
      @action = action
    end

    def run!
      MooTool::ControllerBase.load_all

      controller = MooTool::ControllerBase.for_controller @controller
      controller.new.send @action, self, @remain
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mootool-0.2.8 lib/mootool/command.rb