Sha256: 7d3dc31ccc13b329d1031c220f56b5e4804b1171349769c77841003dc6d47b7f
Contents?: true
Size: 850 Bytes
Versions: 1
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true module Phlexi module Display module Structure class FieldCollection include Enumerable class Builder attr_reader :key, :index def initialize(key, field, index) @key = key.to_s @field = field @index = index end def field(**) @field.class.new(key, **, parent: @field).tap do |field| yield field if block_given? end end end def initialize(field:, collection:, &) @field = field @collection = collection each(&) if block_given? end def each(&) @collection.each.with_index do |item, index| yield Builder.new(item, @field, index) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
phlexi-display-0.0.2 | lib/phlexi/display/structure/field_collection.rb |