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
29 30 31 |
# File 'lib/active_graph/shared/type_converters.rb', line 29 def convert_type Integer end |
.converted?(value) ⇒ Boolean
25 26 27 |
# File 'lib/active_graph/shared/type_converters.rb', line 25 def converted?(value) false end |
.db_type ⇒ Object
33 34 35 |
# File 'lib/active_graph/shared/type_converters.rb', line 33 def db_type Integer end |
.to_db(value) ⇒ Object
37 38 39 40 |
# File 'lib/active_graph/shared/type_converters.rb', line 37 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
42 43 44 |
# File 'lib/active_graph/shared/type_converters.rb', line 42 def to_ruby(value) value.to_i end |