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, = {}) super(names,) @default_value = false if [:default_value].nil? @negatable = [:negatable].nil? ? true : [:negatable] if @default_value != false && @negatable == false raise "A switch with default #{@default_value} that isn't negetable is useless" end end |