Class: Controll::Commander
- Inherits:
-
Object
- Object
- Controll::Commander
- Extended by:
- Imperator::Command::MethodFactory
- Defined in:
- lib/controll/commander.rb
Overview
used to register commands for a controller
Instance Attribute Summary collapse
-
#initiator ⇒ Object
(also: #controller)
readonly
Returns the value of attribute initiator.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .initiator_methods(*names) ⇒ Object (also: controller_methods)
Instance Method Summary collapse
- #command(name, *args) ⇒ Object
- #command!(name, *args) ⇒ Object (also: #use_command, #perform_command)
-
#initialize(initiator, options = {}) ⇒ Commander
constructor
A new instance of Commander.
Constructor Details
#initialize(initiator, options = {}) ⇒ Commander
Returns a new instance of Commander.
9 10 11 12 |
# File 'lib/controll/commander.rb', line 9 def initialize initiator, = {} @initiator = initiator @options = end |
Instance Attribute Details
#initiator ⇒ Object (readonly) Also known as: controller
Returns the value of attribute initiator.
7 8 9 |
# File 'lib/controll/commander.rb', line 7 def initiator @initiator end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/controll/commander.rb', line 7 def @options end |
Class Method Details
.initiator_methods(*names) ⇒ Object Also known as: controller_methods
27 28 29 |
# File 'lib/controll/commander.rb', line 27 def initiator_methods *names delegate names, to: :initiator end |
Instance Method Details
#command(name, *args) ⇒ Object
14 15 16 |
# File 'lib/controll/commander.rb', line 14 def command name, *args send "#{name}_command", *args end |
#command!(name, *args) ⇒ Object Also known as: use_command, perform_command
18 19 20 |
# File 'lib/controll/commander.rb', line 18 def command! name, *args command(name, *args).perform end |