Class: Momomoto::Datatype::Numeric

Inherits:
Base
  • Object
show all
Defined in:
lib/momomoto/datatype/numeric.rb

Overview

This class represents data type Numeric.

Direct Known Subclasses

Real

Instance Method Summary collapse

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