Class: AwsCftTools::TemplateSet

Inherits:
Array
  • Object
show all
Extended by:
Forwardable
Includes:
ArrayMethods, Closure, Dependencies
Defined in:
lib/aws_cft_tools/template_set.rb,
lib/aws_cft_tools/template_set/closure.rb,
lib/aws_cft_tools/template_set/dependencies.rb,
lib/aws_cft_tools/template_set/array_methods.rb,
lib/aws_cft_tools/template_set/each_slice_state.rb

Overview

Management of a set of template sources.

Defined Under Namespace

Modules: ArrayMethods, Closure, Dependencies Classes: EachSliceState

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dependencies

#each_slice, #linked, #provided, #required

Methods included from Closure

#closed_subset, #closure, #filenames, #in_folder_order

Methods included from ArrayMethods

#+, #-, #select, #|

Constructor Details

#initialize(list = []) ⇒ TemplateSet

Returns a new instance of TemplateSet.

Parameters:



36
37
38
39
40
41
42
43
# File 'lib/aws_cft_tools/template_set.rb', line 36

def initialize(list = [])
  @dependency_tree = AwsCftTools::DependencyTree.new
  @sorted_names = []
  @known_exports = []
  super(list)

  list.each { |template| process_template_addition(template) }
end

Instance Attribute Details

#dependency_treeObject (readonly)

Returns the value of attribute dependency_tree.



11
12
13
# File 'lib/aws_cft_tools/template_set.rb', line 11

def dependency_tree
  @dependency_tree
end

#known_exportsObject

Returns the value of attribute known_exports.



10
11
12
# File 'lib/aws_cft_tools/template_set.rb', line 10

def known_exports
  @known_exports
end

Instance Method Details

#defined_variablesObject



31
# File 'lib/aws_cft_tools/template_set.rb', line 31

def_delegators :dependency_tree, :undefined_variables, :defined_variables

#dependencies_for(template) ⇒ AwsCftTools::TemplateSet

Returns set of templates on which the given template depends.

Parameters:

Returns:



80
81
82
# File 'lib/aws_cft_tools/template_set.rb', line 80

def dependencies_for(template)
  templates_for(@dependency_tree.dependencies_for(template.filename.to_s))
end

#dependents_for(template) ⇒ AwsCftTools::TemplateSet

Returns set of templates that depend on the given template.

Parameters:

Returns:



88
89
90
# File 'lib/aws_cft_tools/template_set.rb', line 88

def dependents_for(template)
  templates_for(@dependency_tree.dependents_for(template.filename.to_s))
end

#templates_for(filenames) ⇒ AwsCftTools::TemplateSet

Returns set of templates with the given filenames.

Parameters:

  • filenames (Array<String>)

Returns:



72
73
74
# File 'lib/aws_cft_tools/template_set.rb', line 72

def templates_for(filenames)
  select { |template| filenames.include?(template.filename.to_s) }
end

#undefined_variablesObject



31
# File 'lib/aws_cft_tools/template_set.rb', line 31

def_delegators :dependency_tree, :undefined_variables, :defined_variables