Class: Scheming::Attribute::ListBuilder
- Inherits:
-
Object
- Object
- Scheming::Attribute::ListBuilder
show all
- Defined in:
- lib/scheming/attribute/list_builder.rb
Overview
Attribute Collection Builder
Instance Method Summary
collapse
Constructor Details
#initialize(attributes = []) ⇒ ListBuilder
Returns a new instance of ListBuilder.
7
8
9
10
|
# File 'lib/scheming/attribute/list_builder.rb', line 7
def initialize(attributes = [])
@attributes = attributes
freeze
end
|
Instance Method Details
15
16
17
18
19
20
21
22
|
# File 'lib/scheming/attribute/list_builder.rb', line 15
def attribute(field_name, type:, is_required: true)
attr = Scheming::Attribute.new(
field_name:,
type:,
is_required:
)
self.class.new(@attributes + [attr])
end
|