Method: ConfigureMe::Setting#convert

Defined in:
lib/configure_me/setting.rb

#convert(value) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/configure_me/setting.rb', line 27

def convert(value)
  case type
  when :string    then convert_to_string(value)
  when :integer   then value.to_i rescue value ? 1 : 0
  when :float     then value.to_f rescue value ? 1.0 : 0.0
  when :boolean   then convert_to_boolean(value)
  when :unknown
    @type = infer_type(value)
    convert(value)
  end
end