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.



34
35
36
# File 'lib/stackup/parameters.rb', line 34

def initialize(parameter_hash)
  @parameter_hash = parameter_hash
end

Class Method Details

.new(arg) ⇒ Object



11
12
13
14
15
# File 'lib/stackup/parameters.rb', line 11

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

Instance Method Details

#to_aObject



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

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



38
39
40
# File 'lib/stackup/parameters.rb', line 38

def to_hash
  @parameter_hash.dup
end