Class: R2do::Option
Instance Attribute Summary
Attributes inherited from 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 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/command.rb', line 29 def initialize(short, extended, description, callback) super(short, extended, argument, 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/command.rb', line 43 def execute(args) @callback.call(args) end |