Class: Representable::Deserializer::Collection
- Inherits:
-
Representable::Deserializer
- Object
- Representable::Deserializer
- Representable::Deserializer::Collection
- Defined in:
- lib/representable/deserializer.rb
Overview
Collection does exactly the same as Deserializer but for a collection.
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from Representable::Deserializer
Constructor Details
This class inherits a constructor from Representable::Deserializer
Instance Method Details
#call(fragment) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/representable/deserializer.rb', line 77 def call(fragment) collection = [] # this can be replaced, e.g. AR::Collection or whatever. fragment.each_with_index do |item_fragment, i| # add more per-item options here! next if @binding.evaluate_option(:skip_parse, item_fragment) collection << deserialize!(item_fragment, i) # FIXME: what if obj nil? end collection # with parse_strategy: :sync, this is ignored. end |