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



120
121
122
# File 'lib/active_graph/shared/type_converters.rb', line 120

def convert_type
  Date
end

.db_typeObject



124
125
126
# File 'lib/active_graph/shared/type_converters.rb', line 124

def db_type
  Date
end

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



128
129
130
# File 'lib/active_graph/shared/type_converters.rb', line 128

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