Module: Mongoid::Criteria::Queryable::Extensions::Array::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#evolve(object) ⇒ Object

Evolve the object when the serializer is defined as an array.

Examples:

Evolve the object.

Array.evolve(1)

Parameters:

  • object (Object)

    The object to evolve.

Returns:

  • (Object)

    The evolved object.

Since:

  • 1.0.0



172
173
174
175
176
177
178
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/extensions/array.rb', line 172

def evolve(object)
  if object.is_a?(::Array)
    object.map { |obj| obj.class.evolve(obj) }
  else
    object
  end
end