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
- .convert?(clazz_or_symbol) ⇒ Boolean
- .index_as ⇒ Object
- .to_java(value) ⇒ Object
- .to_ruby(value) ⇒ Object
Class Method Details
.convert?(clazz_or_symbol) ⇒ Boolean
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 |
.index_as ⇒ Object
201 202 203 |
# File 'lib/neo4j/type_converters/type_converters.rb', line 201 def index_as Fixnum end |
.to_java(value) ⇒ Object
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 |
.to_ruby(value) ⇒ Object
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 |