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.



27
28
29
# File 'lib/stackup/parameters.rb', line 27

def initialize(parameter_hash)
  @parameter_hash = parameter_hash
end

Class Method Details

.new(arg) ⇒ Object



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

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

Instance Method Details

#to_aObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/stackup/parameters.rb', line 35

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



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

def to_hash
  @parameter_hash.dup
end