Class: Neo4j::Shared::TypeConverters::BigDecimalConverter
Class Method Summary
collapse
converted?, #supports_array?
Class Method Details
.convert_type ⇒ Object
64
65
66
|
# File 'lib/neo4j/shared/type_converters.rb', line 64
def convert_type
BigDecimal
end
|
.db_type ⇒ Object
68
69
70
|
# File 'lib/neo4j/shared/type_converters.rb', line 68
def db_type
String
end
|
.to_db(value) ⇒ Object
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/neo4j/shared/type_converters.rb', line 72
def to_db(value)
case value
when Rational
value.to_f.to_d
when respond_to?(:to_d)
value.to_d
else
BigDecimal(value.to_s)
end.to_s
end
|
.to_ruby(value) ⇒ Object
83
84
85
|
# File 'lib/neo4j/shared/type_converters.rb', line 83
def to_ruby(value)
value.to_d
end
|