Class: CommandTree::Command
- Inherits:
-
Object
- Object
- CommandTree::Command
- Defined in:
- lib/command_tree/command.rb
Overview
A command class
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(prefix, name, options = {}, &block) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(prefix, name, options = {}, &block) ⇒ Command
Returns a new instance of Command.
6 7 8 9 10 11 |
# File 'lib/command_tree/command.rb', line 6 def initialize(prefix, name, = {}, &block) @prefix = prefix @name = name @desc = [:desc] @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
4 5 6 |
# File 'lib/command_tree/command.rb', line 4 def block @block end |
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
4 5 6 |
# File 'lib/command_tree/command.rb', line 4 def desc @desc end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/command_tree/command.rb', line 4 def name @name end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
4 5 6 |
# File 'lib/command_tree/command.rb', line 4 def prefix @prefix end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 |
# File 'lib/command_tree/command.rb', line 13 def execute block.call end |