class R2do::Commands::Option
Public Class Methods
new(short, extended, description, callback)
click to toggle source
Creates an instance of a Command
@param [String] short the short option name for this command @param [String] extended the full option name for this command @param [String] argument the optional argument for commands that have arguments @param [String] description the command’s description @param [callback] callback the callback method for this command
Calls superclass method
R2do::Command::new
# 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
Public Instance Methods
execute(args)
click to toggle source
Executes the callback of this command
@param [Array] args the collection of arguments @return [void]
# File lib/r2do/option.rb, line 43 def execute(args) @callback.call(args) end