123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Criteria::Queryable::Extensions::Object::ClassMethods

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

Instance Method Summary

Instance Method Details

#__evolve__(object) ⇒ Object (private)

This method is for internal use only.
TODO:

Durran refactor out case statement.

Evolve the object.

Examples:

Evolve an object and yield.

Object.evolve("test") do |obj|
  obj.to_s
end

Returns:

  • (Object)

    The evolved object.

[ GitHub ]

  
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 165

def __evolve__(object)
  return nil if object.nil?
  case object
  when ::Array
    object.map{ |obj| evolve(obj) }
  when ::Range
    object.__evolve_range__
  else
    res = yield(object)
    res.nil? ? object : res
  end
end

#evolve(object) ⇒ Object

Note:

This is here for API compatibility.

Evolve the object.

Examples:

Evolve an object.

Object.evolve("test")

Returns:

  • (Object)

    The provided object.

[ GitHub ]

  
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 147

def evolve(object)
  object
end