123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Extensions::DateTime

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/mongoid/extensions/date_time.rb

Overview

Adds type-casting behavior to Time class.

Instance Method Summary

Instance Method Details

#__mongoize_time__Time | ActiveSupport::TimeWithZone

Mongoize the date time into a time.

Examples:

Mongoize the date time.

date_time.__mongoize_time__

Returns:

[ GitHub ]

  
# File 'lib/mongoid/extensions/date_time.rb', line 16

def __mongoize_time__
  in_time_zone(::Time.zone)
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.

[ GitHub ]

  
# File 'lib/mongoid/extensions/date_time.rb', line 27

def mongoize
  ::DateTime.mongoize(self)
end