module Mongoid::Extensions::TimeWithZone::ClassMethods

Public Instance Methods

demongoize(object) click to toggle source

Convert the object from its mongo friendly ruby type to this type.

@example Demongoize the object.

TimeWithZone.demongoize(object)

@param [ Time ] object The time from Mongo.

@return [ TimeWithZone ] The object as a date.

# File lib/mongoid/extensions/time_with_zone.rb, line 55
def demongoize(object)
  ::Time.demongoize(object).try(:in_time_zone)
end
mongoize(object) click to toggle source

Turn the object from the ruby type we deal with to a Mongo friendly type.

@example Mongoize the object.

TimeWithZone.mongoize("2012-1-1")

@param [ Object ] object The object to convert.

@return [ Time ] The object mongoized.

# File lib/mongoid/extensions/time_with_zone.rb, line 68
def mongoize(object)
  ::Time.mongoize(object)
end