Module: ParamsReady::Marshaller::ArrayMarshallers::ArrayMarshaller
- Extended by:
- AbstractMarshaller
- Defined in:
- lib/params_ready/marshaller/array_marshallers.rb
Class Method Summary collapse
- .canonicalize(definition, array, context, validator, freeze: false) ⇒ Object
- .do_marshal(array, _, _) ⇒ Object
Methods included from AbstractMarshaller
Class Method Details
.canonicalize(definition, array, context, validator, freeze: false) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/params_ready/marshaller/array_marshallers.rb', line 28 def self.canonicalize(definition, array, context, validator, freeze: false) canonical = array.map do |value| next if definition.compact? && value.nil? element = definition.prototype.create element.set_from_input(value, context, validator) next if definition.compact? && element.is_nil? element.freeze if freeze element end.compact [canonical, validator] end |
.do_marshal(array, _, _) ⇒ Object
43 44 45 |
# File 'lib/params_ready/marshaller/array_marshallers.rb', line 43 def self.do_marshal(array, _, _) array end |