Class: ActiveGraph::Shared::TypeConverters::IntegerConverter
- Inherits:
-
BaseConverter
- Object
- BaseConverter
- ActiveGraph::Shared::TypeConverters::IntegerConverter
- Defined in:
- lib/active_graph/shared/type_converters.rb
Constant Summary collapse
- NEO4J_LARGEST_INT =
9223372036854775807
- NEO4J_SMALLEST_INT =
-9223372036854775808
Class Method Summary collapse
- .convert_type ⇒ Object
- .converted?(value) ⇒ Boolean
- .db_type ⇒ Object
- .to_db(value) ⇒ Object
- .to_ruby(value) ⇒ Object
Methods inherited from BaseConverter
Class Method Details
.convert_type ⇒ Object
35 36 37 |
# File 'lib/active_graph/shared/type_converters.rb', line 35 def convert_type Integer end |
.converted?(value) ⇒ Boolean
31 32 33 |
# File 'lib/active_graph/shared/type_converters.rb', line 31 def converted?(value) false end |
.db_type ⇒ Object
39 40 41 |
# File 'lib/active_graph/shared/type_converters.rb', line 39 def db_type Integer end |
.to_db(value) ⇒ Object
43 44 45 46 |
# File 'lib/active_graph/shared/type_converters.rb', line 43 def to_db(value) val = value.to_i val > NEO4J_LARGEST_INT || val < NEO4J_SMALLEST_INT ? val.to_s : val end |
.to_ruby(value) ⇒ Object
48 49 50 |
# File 'lib/active_graph/shared/type_converters.rb', line 48 def to_ruby(value) value.to_i end |