Class: Phlexi::Field::Structure::FieldCollection::Builder
- Inherits:
-
Object
- Object
- Phlexi::Field::Structure::FieldCollection::Builder
- Includes:
- Phlex::Helpers
- Defined in:
- lib/phlexi/field/structure/field_collection.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #field ⇒ Object
-
#initialize(key, field, index) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(key, field, index) ⇒ Builder
Returns a new instance of Builder.
14 15 16 17 18 |
# File 'lib/phlexi/field/structure/field_collection.rb', line 14 def initialize(key, field, index) @key = key.to_s @field = field @index = index end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
12 13 14 |
# File 'lib/phlexi/field/structure/field_collection.rb', line 12 def index @index end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
12 13 14 |
# File 'lib/phlexi/field/structure/field_collection.rb', line 12 def key @key end |
Instance Method Details
#field ⇒ Object
20 21 22 23 24 |
# File 'lib/phlexi/field/structure/field_collection.rb', line 20 def field(**) @field.class.new(key, **, parent: @field).tap do |field| yield field if block_given? end end |