Class: Humidifier::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/humidifier/parameter.rb

Overview

Represents a CFN stack parameter

Constant Summary collapse

PROPERTIES =

The allowed properties of all stack parameters

Utils.underscored(%w[AllowedPattern AllowedValues ConstraintDescription Default Description
MaxLength MaxValue MinLength MinValue NoEcho])

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Parameter

Returns a new instance of Parameter.



10
11
12
13
# File 'lib/humidifier/parameter.rb', line 10

def initialize(opts = {})
  PROPERTIES.values.each { |prop| send(:"#{prop}=", opts[prop]) }
  self.type = opts.fetch(:type, 'String')
end

Instance Method Details

#to_cfObject

CFN stack syntax



16
17
18
19
20
21
22
23
# File 'lib/humidifier/parameter.rb', line 16

def to_cf
  cf = { 'Type' => type }
  PROPERTIES.each do |name, prop|
    val = send(prop)
    cf[name] = Serializer.dump(val) if val
  end
  cf
end