Class: ArgumentTemplateParameter
- Inherits:
-
Object
- Object
- ArgumentTemplateParameter
- Defined in:
- lib/ccios/argument_template_parameter.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#template_variable_name ⇒ Object
readonly
Returns the value of attribute template_variable_name.
Instance Method Summary collapse
-
#initialize(parameter_template_definition_hash) ⇒ ArgumentTemplateParameter
constructor
A new instance of ArgumentTemplateParameter.
- #provided_context_keys ⇒ Object
- #update_context(context) ⇒ Object
Constructor Details
#initialize(parameter_template_definition_hash) ⇒ ArgumentTemplateParameter
Returns a new instance of ArgumentTemplateParameter.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/ccios/argument_template_parameter.rb', line 4 def initialize(parameter_template_definition_hash) @name = parameter_template_definition_hash["argument"] @description = parameter_template_definition_hash["description"] || "" @template_variable_name = parameter_template_definition_hash["template_variable_name"] || @name @removeSuffix = parameter_template_definition_hash["removeSuffix"] || "" @lowercased_name = parameter_template_definition_hash["lowercased_variable_name"] || "" raise "Missing argument name" if @name.nil? || @name.empty? raise "Invalid argument template_variable_name for #{@name}" if @template_variable_name.nil? || template_variable_name.empty? end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
2 3 4 |
# File 'lib/ccios/argument_template_parameter.rb', line 2 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/ccios/argument_template_parameter.rb', line 2 def name @name end |
#template_variable_name ⇒ Object (readonly)
Returns the value of attribute template_variable_name.
2 3 4 |
# File 'lib/ccios/argument_template_parameter.rb', line 2 def template_variable_name @template_variable_name end |
Instance Method Details
#provided_context_keys ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/ccios/argument_template_parameter.rb', line 26 def provided_context_keys context_keys = [@template_variable_name] if !@lowercased_name.empty? context_keys.append(@lowercased_name) end context_keys end |
#update_context(context) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ccios/argument_template_parameter.rb', line 15 def update_context(context) if !@removeSuffix.empty? value = context[@template_variable_name] context[@template_variable_name] = value.gsub(@removeSuffix, "") end if !@lowercased_name.empty? && !context[@lowercased_name] context[@lowercased_name] = context[@template_variable_name].camelize(:lower) end context end |