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


178
179
180
# File 'lib/active_graph/shared/type_converters.rb', line 178

def convert_type
  Time
end

.db_typeObject


182
183
184
# File 'lib/active_graph/shared/type_converters.rb', line 182

def db_type
  Time
end

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


186
187
188
# File 'lib/active_graph/shared/type_converters.rb', line 186

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