Module: Mongoid::Extensions::Date

Defined in:
lib/mongoid/extensions/date.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#__mongoize_time__Time

Convert the date into a time.

Examples:

Convert the date to a time.

date.__mongoize_time__

Returns:

  • (Time)

    The converted time.

Since:

  • 3.0.0



14
15
16
# File 'lib/mongoid/extensions/date.rb', line 14

def __mongoize_time__
  ::Time.configured.local(year, month, day)
end

#mongoizeTime

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

Examples:

Mongoize the object.

date.mongoize

Returns:

  • (Time)

    The object mongoized.

Since:

  • 3.0.0



27
28
29
# File 'lib/mongoid/extensions/date.rb', line 27

def mongoize
  ::Date.mongoize(self)
end