Method: Shoppe::Setting#decoded_value

Defined in:
app/models/shoppe/setting.rb

#decoded_valueObject

The decoded value for the setting attribute (in it’s native type)

Returns:

  • (Object)


30
31
32
33
34
35
36
37
38
# File 'app/models/shoppe/setting.rb', line 30

def decoded_value
  case value_type
  when 'Fixnum'         then  value.to_i
  when 'Float'          then  value.to_f
  when 'Array', 'Hash'  then  JSON.parse(value)
  when 'Boolean'        then  value == 'true' ? true : false
  else                        value.to_s
  end
end