Class: AwsCftTools::DependencyTree::Variables

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_cft_tools/dependency_tree/variables.rb

Overview

Manage list of defined/undefined variables

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVariables

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_variablesObject (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_variablesObject (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.

Parameters:

  • name (String)


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.

Parameters:

  • name (String)


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