Class: Momomoto::Datatype::Integer

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

Overview

This class represents data type Integer.

Direct Known Subclasses

Bigint, Smallint

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 Integer or return nil if value is nil or empty. Raises ConversionError if converting fails.



10
11
12
13
14
15
16
17
# File 'lib/momomoto/datatype/integer.rb', line 10

def filter_set( value )
  case value
    when nil, '' then nil
    else Integer( value )
  end
 rescue => e
  raise ConversionError, e.to_s
end