Module: Origin::Extensions::Range::ClassMethods

Defined in:
lib/origin/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.

Examples:

Evolve the range.

Range.evolve(1..3)

Parameters:

  • object (Range)

    The range to evolve.

Returns:

  • (Hash)

    The range as a gte/lte criteria.

Since:

  • 1.0.0



56
57
58
59
# File 'lib/origin/extensions/range.rb', line 56

def evolve(object)
  return object unless object.is_a?(::Range)
  { "$gte" => object.min, "$lte" => object.max }
end