Class: Jets::Stack::Depends

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/stack/depends/item.rb,
lib/jets/stack/depends.rb

Overview

Usage examples:

Jets::Stack::Depends::Item.new(:custom)
Jets::Stack::Depends::Item.new(:custom, :alert)
Jets::Stack::Depends::Item.new(:custom, class_prefix: true)
Jets::Stack::Depends::Item.new(:custom, :alert, class_prefix: true)

The Jets::Stack::Depends#params uses the options to determine if the class prefix should be added.

Defined Under Namespace

Classes: Item

Instance Method Summary collapse

Constructor Details

#initialize(items) ⇒ Depends

Returns a new instance of Depends.



3
4
5
# File 'lib/jets/stack/depends.rb', line 3

def initialize(items)
  @items = items # Jets::Stack::Depends::Item - has stack and options properties
end

Instance Method Details

#paramsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/jets/stack/depends.rb', line 7

def params
  result = {}
  @items.each do |item|
    class_name = item.class_name
    dependency_outputs(class_name).each do |output|
      dependency_class = class_name.to_s.camelize
      output_key = item.options[:class_prefix] ?
        "#{dependency_class}#{output}" : # already camelized
        output

      output_value = "!GetAtt #{dependency_class}.Outputs.#{output}"
      result[output_key] = output_value
    end
  end
  result
end

#stack_listObject

Returns CloudFormation template logical ids



25
26
27
# File 'lib/jets/stack/depends.rb', line 25

def stack_list
  @items.map(&:logical_id)
end