Class: ActiveGraph::Shared::TypeConverters::TimeConverter

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

Class Method Summary collapse

Methods inherited from BaseConverter

converted?, #supports_array?

Class Method Details

.convert_typeObject



172
173
174
# File 'lib/active_graph/shared/type_converters.rb', line 172

def convert_type
  Time
end

.db_typeObject



176
177
178
# File 'lib/active_graph/shared/type_converters.rb', line 176

def db_type
  Time
end

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



180
181
182
# File 'lib/active_graph/shared/type_converters.rb', line 180

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