Class: R2do::Commands::Option
- Inherits:
-
R2do::Command
- Object
- R2do::Command
- R2do::Commands::Option
- Defined in:
- lib/r2do/option.rb
Instance Attribute Summary
Attributes inherited from R2do::Command
#description, #extended, #short
Instance Method Summary collapse
-
#execute(args) ⇒ void
Executes the callback of this command.
-
#initialize(short, extended, description, callback) ⇒ Option
constructor
Creates an instance of a Command.
Methods inherited from R2do::Command
Constructor Details
#initialize(short, extended, description, callback) ⇒ Option
Creates an instance of a Command
29 30 31 32 33 34 35 36 37 |
# File 'lib/r2do/option.rb', line 29 def initialize(short, extended, description, callback) super(short, extended, description) if callback.nil? raise ArgumentError end @callback = callback end |
Instance Method Details
#execute(args) ⇒ void
This method returns an undefined value.
Executes the callback of this command
43 44 45 |
# File 'lib/r2do/option.rb', line 43 def execute(args) @callback.call(args) end |