Sha256: 22aab2f066f42be9c29b5273f1eaad3ebebe61bc20303c1c8af3d0a95e09fa80

Contents?: true

Size: 672 Bytes

Versions: 8

Compression:

Stored size: 672 Bytes

Contents

# 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

8 entries across 8 versions & 1 rubygems

Version Path
mootool-0.2.7 lib/mootool/command.rb
mootool-0.2.6 lib/mootool/command.rb
mootool-0.2.5 lib/mootool/command.rb
mootool-0.2.4 lib/mootool/command.rb
mootool-0.2.3 lib/mootool/command.rb
mootool-0.2.2 lib/mootool/command.rb
mootool-0.2.1 lib/mootool/command.rb
mootool-0.2 lib/mootool/command.rb