class Convection::Model::Template::Parameter

Template Parameter

Attributes

allowed_values[R]
template[R]

Public Class Methods

new(name, parent) click to toggle source
# File lib/convection/model/template/parameter.rb, line 26
def initialize(name, parent)
  @name = name
  @template = parent.template

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

Public Instance Methods

allow(value) click to toggle source
# File lib/convection/model/template/parameter.rb, line 36
def allow(value)
  allowed_values << value
end
render() click to toggle source
# File lib/convection/model/template/parameter.rb, line 40
def render
  {
    'Type' => type,
    'Default' => default,
    'Description' => description
  }.tap do |resource|
    resource['AllowedValues'] = allowed_values unless allowed_values.empty?
    resource['AllowedPattern'] = allowed_pattern unless allowed_pattern.nil?
    resource['MaxLength'] = max_length unless max_length.nil?
    resource['MinLength'] = min_length unless min_length.nil?
    resource['MaxValue'] = max_value unless max_value.nil?
    resource['MinValue'] = min_value unless min_value.nil?
    resource['NoEcho'] = no_echo unless no_echo.nil?
    resource['ConstraintDescription'] = constraint_description unless constraint_description.nil?
  end
end