Class: ActiveGraph::Shared::TypeConverters::DateConverter

Inherits:
BaseConverter
  • Object
show all
Defined in:
lib/active_graph/shared/type_converters.rb

Overview

Converts Java long types to Date objects. Must be timezone UTC.

Class Method Summary collapse

Methods inherited from BaseConverter

converted?, #supports_array?

Class Method Details

.convert_typeObject



114
115
116
# File 'lib/active_graph/shared/type_converters.rb', line 114

def convert_type
  Date
end

.db_typeObject



118
119
120
# File 'lib/active_graph/shared/type_converters.rb', line 118

def db_type
  Date
end

.to_ruby(value) ⇒ Object Also known as: to_db



122
123
124
# File 'lib/active_graph/shared/type_converters.rb', line 122

def to_ruby(value)
  value.respond_to?(:to_date) ? value.to_date : Time.at(value).utc.to_date
end