123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Criteria::Queryable::Extensions::Range::ClassMethods

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

Instance Method Summary

Instance Method Details

#evolve(object) ⇒ Hash

Evolve the range. This will transform it into a $gte/$lte selection. Endless and beginning-less ranges will use only $gte or $lte respectively. End-excluded ranges (…) will use $lt selector instead of $lte.

Examples:

Evolve the range.

Range.evolve(1..3)

Parameters:

  • object (Range)

    The range to evolve.

Returns:

  • (Hash)

    The range as a gte/lte criteria.

[ GitHub ]

  
# File 'lib/mongoid/criteria/queryable/extensions/range.rb', line 91

def evolve(object)
  return object unless object.is_a?(::Range)
  object.__evolve_range__
end