Module: ParamsReady::Marshaller::ArrayMarshallers::AbstractMarshaller

Included in:
ArrayMarshaller, StringMarshaller, StructMarshaller
Defined in:
lib/params_ready/marshaller/array_marshallers.rb

Instance Method Summary collapse

Instance Method Details

#marshal(parameter, intent) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/params_ready/marshaller/array_marshallers.rb', line 10

def marshal(parameter, intent)
  array = parameter.send(:bare_value)
  definition = parameter.definition
  compact = definition.compact?

  elements = array.map do |element|
    if element.eligible_for_output?(intent)
      element.format_self_permitted(intent)
    end
  end
  elements = elements.compact if compact
  do_marshal(elements, intent, compact)
end