Sha256: c4cc838c0765b4c2436b69355f3d34fd19a6afed7e126588c877077c4551e46e

Contents?: true

Size: 744 Bytes

Versions: 11

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

module Humidifier
  class Parameter
    PROPERTIES =
      Humidifier.underscore(
        %w[AllowedPattern AllowedValues ConstraintDescription Default
           Description MaxLength MaxValue MinLength MinValue NoEcho]
      )

    attr_reader :type, *PROPERTIES.values

    def initialize(opts = {})
      PROPERTIES.each_value do |property|
        instance_variable_set(:"@#{property}", opts[property])
      end

      @type = opts.fetch(:type, 'String')
    end

    # CFN stack syntax
    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
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
humidifier-4.1.1 lib/humidifier/parameter.rb
humidifier-4.0.2 lib/humidifier/parameter.rb
humidifier-4.0.1 lib/humidifier/parameter.rb
humidifier-4.0.0 lib/humidifier/parameter.rb
humidifier-3.5.0 lib/humidifier/parameter.rb
humidifier-3.4.0 lib/humidifier/parameter.rb
humidifier-3.3.0 lib/humidifier/parameter.rb
humidifier-3.2.0 lib/humidifier/parameter.rb
humidifier-3.1.0 lib/humidifier/parameter.rb
humidifier-3.0.1 lib/humidifier/parameter.rb
humidifier-3.0.0 lib/humidifier/parameter.rb