Class: Trane::FieldBuilder
- Inherits:
-
Object
- Object
- Trane::FieldBuilder
- Defined in:
- lib/trane/field_builder.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
-
#field(name, type: nil, extra: false, format: nil, of: nil, enum: nil) { ... } ⇒ Object
Define a field in the current context.
-
#initialize ⇒ FieldBuilder
constructor
A new instance of FieldBuilder.
Constructor Details
#initialize ⇒ FieldBuilder
Returns a new instance of FieldBuilder.
7 8 9 |
# File 'lib/trane/field_builder.rb', line 7 def initialize @fields = [] end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
5 6 7 |
# File 'lib/trane/field_builder.rb', line 5 def fields @fields end |
Instance Method Details
#field(name, type: nil, extra: false, format: nil, of: nil, enum: nil) { ... } ⇒ Object
Define a field in the current context.
20 21 22 23 24 25 26 |
# File 'lib/trane/field_builder.rb', line 20 def field(name, type: nil, extra: false, format: nil, of: nil, enum: nil, &block) @fields << _build_field_node( name: name, type: type, extra: extra, format: format, of: of, enum: enum, child_builder_class: FieldBuilder, required: nil, &block ) end |