lib/convection/model/template/parameter.rb in convection-0.0.1 vs lib/convection/model/template/parameter.rb in convection-0.2.1
- old
+ new
@@ -5,21 +5,29 @@
class Template
##
# Template Parameter
##
class Parameter
- extend DSL::Helpers
- include DSL::IntrinsicFunctions
+ include DSL::Helpers
attribute :type
attribute :default
attribute :description
+ attr_reader :template
+
attr_reader :allowed_values
+ attribute :allowed_pattern
+ attribute :no_echo
+ attribute :max_length
+ attribute :min_length
+ attribute :max_value
+ attribute :min_value
+ attribute :constraint_description
- def initialize(name, template)
+ def initialize(name, parent)
@name = name
- @template = template
+ @template = parent.template
@type = 'String'
@default = ''
@allowed_values = []
@description = ''
@@ -34,9 +42,16 @@
'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
end
end
end