Module: Mongoid::Criteria::Queryable::Extensions::DateTime::ClassMethods

Defined in:
build/mongoid-master/lib/mongoid/criteria/queryable/extensions/date_time.rb

Instance Method Summary collapse

Instance Method Details

#evolve(object) ⇒ Time

Evolve the object to an date.

Examples:

Evolve dates.

Evolve string dates.

Evolve date ranges.

Parameters:

  • object (Object)

    The object to evolve.

Returns:

  • (Time)

    The evolved date time.



36
37
38
39
40
41
42
43
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/extensions/date_time.rb', line 36

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