123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Extensions::Time

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

Overview

Adds type-casting behavior to Time class.

Instance Method Summary

Instance Method Details

#__mongoize_time__Time

Mongoizes a Time into a time.

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

Returns:

  • (Time)

    self.

[ GitHub ]

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

def __mongoize_time__
  self
end

#mongoizeTime | nil

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

Examples:

Mongoize the object.

time.mongoize

Returns:

  • (Time | nil)

    The object mongoized or nil.

[ GitHub ]

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

def mongoize
  ::Time.mongoize(self)
end