Class: Immutabler::Template::Builder
- Inherits:
-
Object
- Object
- Immutabler::Template::Builder
- Defined in:
- lib/immutabler/template/builder.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
Returns the value of attribute group.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(group) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(group) ⇒ Builder
Returns a new instance of Builder.
12 13 14 |
# File 'lib/immutabler/template/builder.rb', line 12 def initialize(group) @group = group end |
Instance Attribute Details
#group ⇒ Object
Returns the value of attribute group.
10 11 12 |
# File 'lib/immutabler/template/builder.rb', line 10 def group @group end |
Instance Method Details
#build ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/immutabler/template/builder.rb', line 16 def build defs = group.build group_name = defs[:name] models = defs[:models].map do |model| { name: model.name, base_class: model.base, base_immutable: model.base_immutable, builder_base_class: model.builder_base, props: build_props(model.props), } end links = defs[:links] module_links = defs[:module_links] enums = defs[:enums] FileUtils.mkdir_p(group.output_directory) build_head(group_name, models, links, module_links, enums) build_body(group_name, models) end |