Sha256: c863cf42c436ae56ee4ecfb137276771ede47e17a24ca04e805658c51dd3ed65

Contents?: true

Size: 623 Bytes

Versions: 3

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

module MooTool
  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

3 entries across 3 versions & 1 rubygems

Version Path
mootool-0.1.2 lib/mootool/command.rb
mootool-0.1.1 lib/mootool/command.rb
mootool-0.1.0 lib/mootool/command.rb