Module: Mongoid::Extensions::Time

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

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

EPOCH =
Deprecated.

No longer used as a return value from #mongoize passed an invalid time string.

Constant for epoch - used when passing invalid times.

::Time.utc(1970, 1, 1, 0, 0, 0)

Instance Method Summary collapse

Instance Method Details

#__mongoize_time__Time

Mongoizes a Time into a time.

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

Returns:

Since:

  • 3.0.0



16
17
18
# File 'build/mongoid-7.3/lib/mongoid/extensions/time.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.

time.mongoize

Returns:

  • (Time)

    The object mongoized.

Since:

  • 3.0.0



35
36
37
# File 'build/mongoid-7.3/lib/mongoid/extensions/time.rb', line 35

def mongoize
  ::Time.mongoize(self)
end