Class: Spinebox::Command::Command
- Inherits:
-
Object
- Object
- Spinebox::Command::Command
- Defined in:
- lib/spinebox/command.rb
Overview
Encapsules a registered command
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(command, desc, options, &block) ⇒ Command
constructor
A new instance of Command.
- #run! ⇒ Object
Constructor Details
#initialize(command, desc, options, &block) ⇒ Command
Returns a new instance of Command.
59 60 61 |
# File 'lib/spinebox/command.rb', line 59 def initialize command, desc, , &block @command, @desc, @options, @block = command, desc, , block end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
55 56 57 |
# File 'lib/spinebox/command.rb', line 55 def command @command end |
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
56 57 58 |
# File 'lib/spinebox/command.rb', line 56 def desc @desc end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
57 58 59 |
# File 'lib/spinebox/command.rb', line 57 def @options end |
Instance Method Details
#run! ⇒ Object
63 64 65 66 67 |
# File 'lib/spinebox/command.rb', line 63 def run! return false unless @options[:if].call @block.call true end |