class Convection::Model::Attributes

Manage parameters and attributes across stacks

Attributes

stacks[R]

Public Class Methods

new() click to toggle source
# File lib/convection/model/attributes.rb, line 41
def initialize
  @stacks = Hash.new do |hash, key|
    hash[key] = Stack.new
  end
end

Public Instance Methods

fetch(stack, key, default = nil) click to toggle source
# File lib/convection/model/attributes.rb, line 51
def fetch(stack, key, default = nil)
  return get(stack, key, default) unless default.nil?
  raise KeyError, "key '#{key}' not found for stack '#{stack}'" unless include?(stack, key)

  @stacks[stack.to_s].fetch(key.to_s)
end
get(stack, key, default = nil) click to toggle source
# File lib/convection/model/attributes.rb, line 58
def get(stack, key, default = nil)
  include?(stack, key) ? @stacks[stack.to_s][key.to_s] : default
end
include?(stack, key) click to toggle source
# File lib/convection/model/attributes.rb, line 47
def include?(stack, key)
  @stacks.include?(stack) && @stacks[stack].include?(key)
end
load_outputs(stack) click to toggle source
# File lib/convection/model/attributes.rb, line 66
def load_outputs(stack)
  @stacks[stack.name.to_s].outputs = stack.outputs
end
load_resources(stack) click to toggle source
# File lib/convection/model/attributes.rb, line 70
def load_resources(stack)
  @stacks[stack.name.to_s].resources = stack.attribute_mapping_values
end
set(stack, key, value) click to toggle source
# File lib/convection/model/attributes.rb, line 62
def set(stack, key, value)
  @stacks[stack.to_s][key.to_s] = value
end