Class: ApiBlueprint::Builder
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- ApiBlueprint::Builder
- Defined in:
- lib/api-blueprint/builder.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
writeonly
Sets the attribute body.
Instance Method Summary collapse
Instance Attribute Details
#body=(value) ⇒ Object (writeonly)
Sets the attribute body
10 11 12 |
# File 'lib/api-blueprint/builder.rb', line 10 def body=(value) @body = value end |
Instance Method Details
#build ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/api-blueprint/builder.rb', line 12 def build if body.is_a? Array body.collect { |item| build_item prepare_item(item) } else build_item prepare_item(body) end end |
#build_item(item) ⇒ Object
24 25 26 |
# File 'lib/api-blueprint/builder.rb', line 24 def build_item(item) creates.new item end |
#prepare_item(item) ⇒ Object
20 21 22 |
# File 'lib/api-blueprint/builder.rb', line 20 def prepare_item(item) with_replacements item.with_indifferent_access end |