Class: Humidifier::Parameter
- Inherits:
-
Object
- Object
- Humidifier::Parameter
- Defined in:
- lib/humidifier/parameter.rb
Constant Summary collapse
- PROPERTIES =
Humidifier.underscore( %w[AllowedPattern AllowedValues ConstraintDescription Default Description MaxLength MaxValue MinLength MinValue NoEcho] )
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Parameter
constructor
A new instance of Parameter.
-
#to_cf ⇒ Object
CFN stack syntax.
Constructor Details
#initialize(opts = {}) ⇒ Parameter
Returns a new instance of Parameter.
13 14 15 16 17 18 19 |
# File 'lib/humidifier/parameter.rb', line 13 def initialize(opts = {}) PROPERTIES.each_value do |property| instance_variable_set(:"@#{property}", opts[property]) end @type = opts.fetch(:type, "String") end |
Instance Method Details
#to_cf ⇒ Object
CFN stack syntax
22 23 24 25 26 27 28 29 |
# File 'lib/humidifier/parameter.rb', line 22 def to_cf { "Type" => type }.tap do |cf| PROPERTIES.each do |name, prop| value = public_send(prop) cf[name] = Serializer.dump(value) if value end end end |