Class: Momomoto::Datatype::Numeric
- Defined in:
- lib/momomoto/datatype/numeric.rb
Overview
This class represents data type Numeric.
Direct Known Subclasses
Instance Method Summary collapse
-
#filter_set(value) ⇒ Object
Values are filtered by this method when being set.
Methods inherited from Base
#compile_rule, #default, #default_operator, #equal, #escape, #initialize, #not_null?, operator_sign
Constructor Details
This class inherits a constructor from Momomoto::Datatype::Base
Instance Method Details
#filter_set(value) ⇒ Object
Values are filtered by this method when being set. Converts value
to Float or returns nil if value
is nil or empty.
11 12 13 14 15 16 17 18 |
# File 'lib/momomoto/datatype/numeric.rb', line 11 def filter_set( value ) case value when nil, '' then nil else Float( value ) end rescue => e raise ConversionError, e.to_s end |