Sha256: 09c9e74b828f23ff76da078bca3de556edecee54c208c397e3bb14e17585be71
Contents?: true
Size: 536 Bytes
Versions: 2
Compression:
Stored size: 536 Bytes
Contents
module RiceBubble class Attributes class Array < Base attr_reader :members def initialize(members, &) super(&) @members = instantiate(members) end def valid?(value) return false unless value.respond_to?(:all?) value.all? do |child| members.valid?(child) end end def call(value, path: '') (value || []).map.with_index do |child, index| members.call(child, path: "#{path}[#{index}]") end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rice_bubble-0.2.1 | lib/rice_bubble/attributes/array.rb |
rice_bubble-0.2.0 | lib/rice_bubble/attributes/array.rb |