class StoreSchema::Converter::Float
Constants
- INT_FLOAT_FORMAT
@return [Regexp] an (int | float) value format.
Public Instance Methods
from_db()
click to toggle source
Converts the {#value} to a Ruby-type value.
@return [Float]
# File lib/store_schema/converter/float.rb, line 36 def from_db value.to_f end
to_db()
click to toggle source
Converts the {#value} to a database-storable value.
@return [String, false] false if {#value} is an invalid date-type.
# File lib/store_schema/converter/float.rb, line 15 def to_db case value when ::Integer value.to_f.to_s when ::Float value.to_s when ::String if value.match(INT_FLOAT_FORMAT) value.to_f.to_s else false end else false end end