Class: Neo4j::TypeConverters::TimeConverter
- Inherits:
-
Object
- Object
- Neo4j::TypeConverters::TimeConverter
- Defined in:
- lib/neo4j/type_converters/type_converters.rb
Class Method Summary (collapse)
- + (Boolean) convert?(clazz_or_symbol)
- + (Object) index_as
-
+ (Object) to_java(value)
Converts the given DateTime (UTC) value to an Fixnum.
- + (Object) to_ruby(value)
Class Method Details
+ (Boolean) convert?(clazz_or_symbol)
244 245 246 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 244 def convert?(clazz_or_symbol) Time == clazz_or_symbol || :time == clazz_or_symbol end |
+ (Object) index_as
264 265 266 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 264 def index_as Fixnum end |
+ (Object) to_java(value)
Converts the given DateTime (UTC) value to an Fixnum. Only utc times are supported !
250 251 252 253 254 255 256 257 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 250 def to_java(value) return nil if value.nil? if value.class == Date Time.utc(value.year, value.month, value.day, 0, 0, 0).to_i else value.utc.to_i end end |
+ (Object) to_ruby(value)
259 260 261 262 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 259 def to_ruby(value) return nil if value.nil? Time.at(value).utc end |