Method: ConfigParser::Switch#parse
- Defined in:
- lib/config_parser/switch.rb
#parse(switch, value, argv) ⇒ Object
Calls the block with false if the negative long is specified, or calls the block with true in all other cases. Raises an error if a value is specified.
31 32 33 34 35 |
# File 'lib/config_parser/switch.rb', line 31 def parse(switch, value, argv) raise "value specified for switch: #{switch}" if value value = (switch == negative_long ? false : true) block ? block.call(value) : value end |