Class: GDK::ConfigType::Bool

Inherits:
Base
  • Object
show all
Defined in:
lib/gdk/config_type/bool.rb

Instance Attribute Summary

Attributes inherited from Base

#builder, #parent, #user_value, #value

Instance Method Summary collapse

Methods inherited from Base

#default_value, #dump!, #initialize, #root, #slug, #user_defined?, #validate!

Constructor Details

This class inherits a constructor from GDK::ConfigType::Base

Instance Method Details

#parse(value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/gdk/config_type/bool.rb', line 6

def parse(value)
  case value
  when 'true', true, 't', '1', 1
    true
  when 'false', false, 'f', '0', 0
    false
  else
    raise ::TypeError
  end
end