Module: Mongoid::Extensions::TimeWithZone

Defined in:
build/mongoid-7.3/lib/mongoid/extensions/time_with_zone.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#__mongoize_time__ActiveSupport::TimeWithZone

Mongoizes an ActiveSupport::TimeWithZone into a time.

TimeWithZone always mongoize into TimeWithZone instances (which are themselves).

Returns:

  • (ActiveSupport::TimeWithZone)

    self.

Since:

  • 3.0.0



16
17
18
# File 'build/mongoid-7.3/lib/mongoid/extensions/time_with_zone.rb', line 16

def __mongoize_time__
  self
end

#mongoizeTime

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

Examples:

Mongoize the object.

date_time.mongoize

Returns:

  • (Time)

    The object mongoized.

Since:

  • 3.0.0



29
30
31
# File 'build/mongoid-7.3/lib/mongoid/extensions/time_with_zone.rb', line 29

def mongoize
  ::ActiveSupport::TimeWithZone.mongoize(self)
end