Module: Origin::Extensions::Array::ClassMethods

Defined in:
lib/origin/extensions/array.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) evolve(object)

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

Examples:

Evolve the object.

Array.evolve(1)

Parameters:

  • The (Object)

    object to evolve.

Returns:

  • (Object)

    The evolved object.

Since:

  • 1.0.0



168
169
170
171
172
173
174
# File 'lib/origin/extensions/array.rb', line 168

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