Class: Jets::Stack::Builder
- Inherits:
-
Object
- Object
- Jets::Stack::Builder
- Extended by:
- Memoist
- Defined in:
- lib/jets/stack/builder.rb
Instance Method Summary collapse
- #build_elements(section) ⇒ Object
- #build_section(section) ⇒ Object
-
#initialize(stack) ⇒ Builder
constructor
A new instance of Builder.
- #template ⇒ Object
Constructor Details
#initialize(stack) ⇒ Builder
Returns a new instance of Builder.
5 6 7 8 |
# File 'lib/jets/stack/builder.rb', line 5 def initialize(stack) @stack = stack @template = {} # will build this structure up end |
Instance Method Details
#build_elements(section) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/jets/stack/builder.rb', line 23 def build_elements(section) # s is a "section element". Examples: # # Jets::Stack::Parameter # Jets::Stack::Resource # Jets::Stack::Output # section_elements = @stack.send(section) return unless section_elements section_elements.inject({}) do |template_section, s| template_section.merge(s.template) end end |
#build_section(section) ⇒ Object
18 19 20 21 |
# File 'lib/jets/stack/builder.rb', line 18 def build_section(section) elements = build_elements(section) @template[section] = elements if elements end |