Method: Dry::Schema::Key::Array#write

Defined in:
lib/dry/schema/key.rb

#write(source, target) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



151
152
153
154
155
156
157
158
159
160
# File 'lib/dry/schema/key.rb', line 151

def write(source, target)
  read(source) { |value|
    target[coerced_name] =
      if value.is_a?(::Array)
        value.map { |el| el.is_a?(::Hash) ? member.write(el) : el }
      else
        value
      end
  }
end