Class: Stackup::Parameters

Inherits:
Object
  • Object
show all
Defined in:
lib/stackup/parameters.rb

Overview

Parameters to a CloudFormation template.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameter_hash) ⇒ Parameters

Returns a new instance of Parameters.



32
33
34
# File 'lib/stackup/parameters.rb', line 32

def initialize(parameter_hash)
  @parameter_hash = parameter_hash
end

Class Method Details

.new(arg) ⇒ Object



9
10
11
12
13
# File 'lib/stackup/parameters.rb', line 9

def new(arg)
  arg ||= {}
  arg = hashify(arg) unless arg.is_a?(Hash)
  super(arg)
end

Instance Method Details

#to_aObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/stackup/parameters.rb', line 40

def to_a
  @parameter_hash.map do |key, value|
    { :parameter_key => key }.tap do |record|
      if value == :use_previous_value
        record[:use_previous_value] = true
      else
        record[:parameter_value] = value
      end
    end
  end
end

#to_hashObject



36
37
38
# File 'lib/stackup/parameters.rb', line 36

def to_hash
  @parameter_hash.dup
end