lib/rice_bubble/attributes/array.rb in rice_bubble-0.1.2 vs lib/rice_bubble/attributes/array.rb in rice_bubble-0.2.0

- old
+ new

@@ -14,21 +14,13 @@ value.all? do |child| members.valid?(child) end end - def validate!(_value, coerced:, path:) - coerced.each.with_index do |child, index| - members.validate!( - child, - coerced: members.coerce(child), - path: "#{path}[#{index}]" - ) + def call(value, path: '') + (value || []).map.with_index do |child, index| + members.call(child, path: "#{path}[#{index}]") end - end - - def coerce(value) - value.respond_to?(:to_a) ? value.to_a : value end end end end