Class: AwsCftTools::DependencyTree::Variables
- Inherits:
-
Object
- Object
- AwsCftTools::DependencyTree::Variables
- Defined in:
- lib/aws_cft_tools/dependency_tree/variables.rb
Overview
Manage list of defined/undefined variables
Instance Attribute Summary collapse
-
#defined_variables ⇒ Object
readonly
Returns the value of attribute defined_variables.
-
#undefined_variables ⇒ Object
readonly
Returns the value of attribute undefined_variables.
Instance Method Summary collapse
-
#defined(name) ⇒ Object
Notes that the given variable name is provided either by the CloudFormation environment or by another template.
-
#initialize ⇒ Variables
constructor
A new instance of Variables.
-
#referenced(name) ⇒ Object
Notes that the given variable name is used as an input into a template.
Constructor Details
#initialize ⇒ Variables
Returns a new instance of Variables.
11 12 13 14 |
# File 'lib/aws_cft_tools/dependency_tree/variables.rb', line 11 def initialize @undefined_variables = [] @defined_variables = [] end |
Instance Attribute Details
#defined_variables ⇒ Object (readonly)
Returns the value of attribute defined_variables.
9 10 11 |
# File 'lib/aws_cft_tools/dependency_tree/variables.rb', line 9 def defined_variables @defined_variables end |
#undefined_variables ⇒ Object (readonly)
Returns the value of attribute undefined_variables.
9 10 11 |
# File 'lib/aws_cft_tools/dependency_tree/variables.rb', line 9 def undefined_variables @undefined_variables end |
Instance Method Details
#defined(name) ⇒ Object
Notes that the given variable name is provided either by the CloudFormation environment or by another template.
22 23 24 25 |
# File 'lib/aws_cft_tools/dependency_tree/variables.rb', line 22 def defined(name) @undefined_variables -= [name] @defined_variables |= [name] end |
#referenced(name) ⇒ Object
Notes that the given variable name is used as an input into a template.
32 33 34 |
# File 'lib/aws_cft_tools/dependency_tree/variables.rb', line 32 def referenced(name) @undefined_variables |= [name] unless @defined_variables.include?(name) end |