123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Criteria::Queryable::Extensions::Date::ClassMethods

Relationships & Source Files
Defined in: lib/mongoid/criteria/queryable/extensions/date.rb

Instance Method Summary

Instance Method Details

#evolve(object) ⇒ Time

Evolve the object to an date.

Examples:

Evolve dates.

Date.evolve(Date.new(1990, 1, 1))

Evolve string dates.

Date.evolve("1990-1-1")

Evolve date ranges.

Date.evolve(Date.new(1990, 1, 1)..Date.new(1990, 1, 4))

Parameters:

  • object (Object)

    The object to evolve.

Returns:

  • (Time)

    The evolved date.

[ GitHub ]

  
# File 'lib/mongoid/criteria/queryable/extensions/date.rb', line 48

def evolve(object)
  res = begin
    object.try(:__evolve_date__)
  rescue ArgumentError
    nil
  end
  res.nil? ? object : res
end