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

Defined in:
build/mongoid-7.4/lib/mongoid/criteria/queryable/extensions/range.rb

Instance Method Summary collapse

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.



82
83
84
85
# File 'build/mongoid-7.4/lib/mongoid/criteria/queryable/extensions/range.rb', line 82

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