Class: Representable::Serializer::Collection

Inherits:
Representable::Serializer show all
Defined in:
lib/representable/serializer.rb

Instance Method Summary collapse

Methods inherited from Representable::Serializer

#call

Methods inherited from Deserializer

#call, #initialize

Constructor Details

This class inherits a constructor from Representable::Deserializer

Instance Method Details

#serialize(array, *args) ⇒ Object


36
37
38
39
40
41
42
43
44
45
46
# File 'lib/representable/serializer.rb', line 36

def serialize(array, *args)
  collection = [] # TODO: unify with Deserializer::Collection.

  array.each do |item|
    next if @binding.evaluate_option(:skip_render, item) # TODO: allow skipping entire collections? same for deserialize.

    collection << serialize!(item, *args)
  end # TODO: i don't want Array but Forms here - what now?

  collection
end