Class: StackLoop::App::Command
- Inherits:
-
Object
- Object
- StackLoop::App::Command
- Defined in:
- lib/stack_loop/app.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, desc = nil, &action) ⇒ Command
constructor
A new instance of Command.
- #run(arg_array) ⇒ Object
Constructor Details
#initialize(name, desc = nil, &action) ⇒ Command
Returns a new instance of Command.
8 9 10 11 12 |
# File 'lib/stack_loop/app.rb', line 8 def initialize(name, desc=nil, &action) @name = name @desc = desc @action = action end |
Instance Attribute Details
#desc ⇒ Object
Returns the value of attribute desc.
6 7 8 |
# File 'lib/stack_loop/app.rb', line 6 def desc @desc end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/stack_loop/app.rb', line 6 def name @name end |
Instance Method Details
#run(arg_array) ⇒ Object
14 15 16 |
# File 'lib/stack_loop/app.rb', line 14 def run(arg_array) @action.call(arg_array) end |