Class: Convection::Model::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/convection/model/attributes.rb

Overview

Manage parameters and attributes across stacks

Defined Under Namespace

Classes: Stack

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttributes

Returns a new instance of Attributes



33
34
35
36
37
# File 'lib/convection/model/attributes.rb', line 33

def initialize
  @stacks = Hash.new do |hash, key|
    hash[key] = Stack.new
  end
end

Instance Attribute Details

#stacksObject (readonly)

Returns the value of attribute stacks



31
32
33
# File 'lib/convection/model/attributes.rb', line 31

def stacks
  @stacks
end

Instance Method Details

#get(stack, key, default = nil) ⇒ Object



43
44
45
# File 'lib/convection/model/attributes.rb', line 43

def get(stack, key, default = nil)
  include?(stack, key) ? @stacks[stack.to_s][key.to_s] : default
end

#include?(stack, key) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/convection/model/attributes.rb', line 39

def include?(stack, key)
  @stacks.include?(stack) && @stacks[stack].include?(key)
end

#load_outputs(stack) ⇒ Object



51
52
53
# File 'lib/convection/model/attributes.rb', line 51

def load_outputs(stack)
  @stacks[stack.name.to_s].outputs = stack.outputs
end

#load_resources(stack) ⇒ Object



55
56
57
# File 'lib/convection/model/attributes.rb', line 55

def load_resources(stack)
  @stacks[stack.name.to_s].resources = stack.attribute_mapping_values
end

#set(stack, key, value) ⇒ Object



47
48
49
# File 'lib/convection/model/attributes.rb', line 47

def set(stack, key, value)
  @stacks[stack.to_s][key.to_s] = value
end