Class: Rasti::DB::TypeConverters::TimeInZone

Inherits:
Object
  • Object
show all
Defined in:
lib/rasti/db/type_converters/time_in_zone.rb

Class Method Summary collapse

Class Method Details

.from_db(value) ⇒ Object



12
13
14
# File 'lib/rasti/db/type_converters/time_in_zone.rb', line 12

def from_db(value)
  value.is_a?(Time) ? Timing::TimeInZone.new(value) : value
end

.to_db(db, collection_name, attribute_name, value) ⇒ Object



8
9
10
# File 'lib/rasti/db/type_converters/time_in_zone.rb', line 8

def to_db(db, collection_name, attribute_name, value)
  value.is_a?(Timing::TimeInZone) ? value.to_time : value
end