Sha256: 834487b0e1926dfe7693d7bd601c3a705d0d632d0993ef58a60e7562efa4666c

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

require_relative '../../dsl/intrinsic_functions'

module Convection
  module Model
    class Template
      ##
      # Template Parameter
      ##
      class Parameter
        extend DSL::Helpers
        include DSL::IntrinsicFunctions

        attribute :type
        attribute :default
        attribute :description
        attr_reader :allowed_values

        def initialize(name, template)
          @name = name
          @template = template

          @type = 'String'
          @default = ''
          @allowed_values = []
          @description = ''
        end

        def allow(value)
          allowed_values << value
        end

        def render
          {
            'Type' => type,
            'Default' => default,
            'Description' => description
          }.tap do |resource|
            resource['AllowedValues'] = allowed_values unless allowed_values.empty?
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convection-0.0.1 lib/convection/model/template/parameter.rb