Class: MooTool::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/mootool/command.rb

Overview

Abstract base command for all command types.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, _output_format, controller, action, remain) ⇒ Command

Returns a new instance of Command.



13
14
15
16
17
18
19
# File 'lib/mootool/command.rb', line 13

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

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



7
8
9
# File 'lib/mootool/command.rb', line 7

def action
  @action
end

#controllerObject (readonly)

Returns the value of attribute controller.



7
8
9
# File 'lib/mootool/command.rb', line 7

def controller
  @controller
end

#fileObject (readonly)

Returns the value of attribute file.



7
8
9
# File 'lib/mootool/command.rb', line 7

def file
  @file
end

#output_formatObject (readonly)

Returns the value of attribute output_format.



7
8
9
# File 'lib/mootool/command.rb', line 7

def output_format
  @output_format
end

#remainObject (readonly)

Returns the value of attribute remain.



7
8
9
# File 'lib/mootool/command.rb', line 7

def remain
  @remain
end

Class Method Details

.parse(args) ⇒ Object



9
10
11
# File 'lib/mootool/command.rb', line 9

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

Instance Method Details

#run!Object



21
22
23
24
25
26
# File 'lib/mootool/command.rb', line 21

def run!
  MooTool::ControllerBase.load_all

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