Class: Neo4j::Shared::TypeConverters::TimeConverter
Class Method Summary
collapse
converted?, #supports_array?
Class Method Details
.convert_type ⇒ Object
200
201
202
|
# File 'lib/neo4j/shared/type_converters.rb', line 200
def convert_type
Time
end
|
.db_type ⇒ Object
204
205
206
|
# File 'lib/neo4j/shared/type_converters.rb', line 204
def db_type
Integer
end
|
.to_db(value) ⇒ Object
Converts the given DateTime (UTC) value to an Integer. Only utc times are supported !
210
211
212
213
214
215
216
|
# File 'lib/neo4j/shared/type_converters.rb', line 210
def to_db(value)
if value.class == Date
Time.utc(value.year, value.month, value.day, 0, 0, 0).to_i
else
value.utc.to_i
end
end
|
.to_ruby(value) ⇒ Object
218
219
220
|
# File 'lib/neo4j/shared/type_converters.rb', line 218
def to_ruby(value)
Time.at(value).utc
end
|