Method: Coglius::Switch#initialize

Defined in:
lib/coglius/switch.rb

#initialize(names, options = {}) ⇒ Switch

Creates a new switch

names - Array of symbols or strings representing the names of this switch options - hash of options:

:desc - the short description
:long_desc - the long description
:negatable - true or false if this switch is negatable; defaults to true
:default_value - default value if the switch is omitted


18
19
20
21
22
23
24
25
# File 'lib/coglius/switch.rb', line 18

def initialize(names,options = {})
  super(names,options)
  @default_value = false if options[:default_value].nil?
  @negatable = options[:negatable].nil? ? true : options[:negatable]
  if @default_value != false && @negatable == false
    raise "A switch with default #{@default_value} that isn't negetable is useless"
  end
end