Sha256: ad372c7efea73be2bd417b69c2b6839505c3dbad92cb90907d77bcc2493bcb36

Contents?: true

Size: 1012 Bytes

Versions: 136

Compression:

Stored size: 1012 Bytes

Contents

class Jets::Stack
  class Builder
    extend Memoist

    def initialize(stack)
      @stack = stack
      @template = {} # will build this structure up
    end

    def template
      build_section(:parameters)
      build_section(:resources)
      build_section(:outputs)
      Jets::Camelizer.transform(@template)
    end
    memoize :template

    def build_section(section)
      elements = build_elements(section)
      return unless elements

      if section == :parameters
        elements["GemLayer"] = {"Type"=>"String"} unless Jets.poly_only?
      end
      @template[section] = elements
    end

    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
  end
end

Version data entries

136 entries across 136 versions & 3 rubygems

Version Path
jets-4.0.12 lib/jets/stack/builder.rb
jets-4.0.11 lib/jets/stack/builder.rb
jets-4.0.10 lib/jets/stack/builder.rb
jets-4.0.9 lib/jets/stack/builder.rb
jets-4.0.8 lib/jets/stack/builder.rb
jets-4.0.7 lib/jets/stack/builder.rb
jets-4.0.6 lib/jets/stack/builder.rb
jets-4.0.5 lib/jets/stack/builder.rb
jets-4.0.4 lib/jets/stack/builder.rb
jets-4.0.3 lib/jets/stack/builder.rb
jets-4.0.2 lib/jets/stack/builder.rb
jets-4.0.1 lib/jets/stack/builder.rb
jets-4.0.0 lib/jets/stack/builder.rb
jets-3.2.2 lib/jets/stack/builder.rb
jets-3.2.1 lib/jets/stack/builder.rb
jets.benforeva-3.0.17.pre.mount.pre.fix lib/jets/stack/builder.rb
jets-3.2.0 lib/jets/stack/builder.rb
jets-3.1.5 lib/jets/stack/builder.rb
jets-3.1.4 lib/jets/stack/builder.rb
jets-3.1.3 lib/jets/stack/builder.rb