Class: Commands::OptionWithArg
- Inherits:
-
CommandOption
- Object
- CommandOption
- Commands::OptionWithArg
- Defined in:
- lib/commands.rb
Instance Attribute Summary
Attributes inherited from CommandOption
#arg, #commands, #description, #name, #parent_commands
Instance Method Summary collapse
Methods inherited from CommandOption
Constructor Details
This class inherits a constructor from Commands::CommandOption
Instance Method Details
#attach(commands) ⇒ Object
1258 1259 1260 1261 1262 1263 1264 1265 |
# File 'lib/commands.rb', line 1258 def attach(commands) command = super(commands) if @pattern && ! @arg.match(@pattern) then raise RuntimeError, "Expected argument to #{@name} to match #{@pattern.inspect}, but it didn't" end command.option(@name, @field_symbol, @arg) return command end |