Method: ConfigParser::Switch#initialize

Defined in:
lib/config_parser/switch.rb

#initialize(options = {}) ⇒ Switch

Initializes a new Switch. Raises an error if an arg_name is specified for self (as switches are intended to be boolean in nature), or if no long option is specified.

Raises:

  • (ArgumentError)


15
16
17
18
19
20
# File 'lib/config_parser/switch.rb', line 15

def initialize(options={})
  super
  raise ArgumentError, "arg_name specified for switch: #{arg_name}" if arg_name
  raise ArgumentError, "no long specified" unless long
  @negative_long = Utils.prefix_long(long, 'no-')
end