Class: Neo4j::TypeConverters::DateConverter
- Inherits:
-
Object
- Object
- Neo4j::TypeConverters::DateConverter
- Defined in:
- lib/neo4j/type_converters/type_converters.rb
Overview
Converts Date objects to Java long types. Must be timezone UTC.
Class Method Summary (collapse)
- + (Boolean) convert?(clazz_or_symbol)
- + (Object) index_as
- + (Object) to_java(value)
- + (Object) to_ruby(value)
Class Method Details
+ (Boolean) convert?(clazz_or_symbol)
187 188 189 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 187 def convert?(clazz_or_symbol) Date == clazz_or_symbol || :date == clazz_or_symbol end |
+ (Object) index_as
201 202 203 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 201 def index_as Fixnum end |
+ (Object) to_java(value)
191 192 193 194 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 191 def to_java(value) return nil if value.nil? Time.utc(value.year, value.month, value.day).to_i end |
+ (Object) to_ruby(value)
196 197 198 199 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 196 def to_ruby(value) return nil if value.nil? Time.at(value).utc.to_date end |