Class: Phlexi::Field::Structure::FieldCollection
- Inherits:
-
Object
- Object
- Phlexi::Field::Structure::FieldCollection
- Includes:
- Enumerable
- Defined in:
- lib/phlexi/field/structure/field_collection.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Builder
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(field:, collection:) ⇒ FieldCollection
constructor
A new instance of FieldCollection.
Constructor Details
#initialize(field:, collection:) ⇒ FieldCollection
Returns a new instance of FieldCollection.
27 28 29 30 31 |
# File 'lib/phlexi/field/structure/field_collection.rb', line 27 def initialize(field:, collection:, &) @field = field @collection = build_collection(collection) each(&) if block_given? end |
Instance Method Details
#each ⇒ Object
33 34 35 36 37 |
# File 'lib/phlexi/field/structure/field_collection.rb', line 33 def each(&) @collection.each.with_index do |item, index| yield self.class::Builder.new(item, @field, index) end end |