Class: Commands::ParamOption
- Inherits:
-
CommandOption
- Object
- CommandOption
- Commands::ParamOption
- Defined in:
- lib/commands.rb
Instance Attribute Summary
Attributes inherited from CommandOption
#arg, #commands, #description, #name, #parent_commands
Instance Method Summary collapse
- #attach(commands) ⇒ Object
-
#initialize(*args) ⇒ ParamOption
constructor
A new instance of ParamOption.
Constructor Details
#initialize(*args) ⇒ ParamOption
Returns a new instance of ParamOption.
1314 1315 1316 1317 |
# File 'lib/commands.rb', line 1314 def initialize(*args) super(*args) @params = [] end |
Instance Method Details
#attach(commands) ⇒ Object
1319 1320 1321 1322 1323 1324 1325 1326 1327 |
# File 'lib/commands.rb', line 1319 def attach(commands) command = super(commands) if match = @arg.match(/([^=]+)=(.*)/) then command.option(@name, @field_symbol, { :key => match[1], :value => match[2] }) else raise RuntimeError, "Expected '#{@arg}' to be in the form VARIABLE=VALUE" end return command end |