lib/active_configuration/setting_proxy.rb
# Coerces a stored String value into the expected type if an allowed format
# is explicitly set on this setting's option.
#
# Note: Because values are validated against given formats when updated,
# it is assumed that they can be properly coerced back to their intended
# type.
#
# @param [String] value the value stored in the database that must be coerced.
#
# @return [String, Fixnum, Float, TrueClass, FalseClass] the properly coerced
#   value, assuming the value should be coerced.
Coerces a stored String value into the expected type if an allowed format
is explicitly set on this setting's option.

Because values are validated against given formats when updated,
it is assumed that they can be properly coerced back to their intended
type.
Coerces a stored String value into the expected type if an allowed format is explicitly set on this setting ' s option . Because values are validated against given formats when updated it is assumed that they can be properly coerced back to their intended type .
def coerce(value)
      if !value.nil? and !option.allowed_format.nil?
        case option.allowed_format
        when 'fixnum'
          value = value.to_i
        when 'float'
          value = value.to_f
        when 'boolean'
          value = true  if (value == 'true'  or value == 't')
          value = false if (value == 'false' or value == 'f')
        end
      end
      return value
    end
def coerce ( value ) if ! value . nil? and ! option . allowed_format . nil? case option . allowed_format when 'fixnum' value = value . to_i when 'float' value = value . to_f when 'boolean' value = true if ( value == 'true' or value == 't' ) value = false if ( value == 'false' or value == 'f' ) end end return value end
Coerces a stored String value into the expected type if an allowed format
is explicitly set on this setting's option.
Coerces a stored String value into the expected type if an allowed format is explicitly set on this setting ' s option .
the properly coerced value, assuming the value should be coerced.
the properly coerced value assuming the value should be coerced .
String, Fixnum, Float, TrueClass, FalseClass
value
<not_specific>
<not_specific>
value the value stored in the database that must be coerced.
value the value stored in the database that must be coerced .