Module: AwsCftTools::TemplateSet::Dependencies

Included in:
AwsCftTools::TemplateSet
Defined in:
lib/aws_cft_tools/template_set/dependencies.rb

Overview

Simple derived information about templates.

Instance Method Summary collapse

Instance Method Details

#each_slice(maximum_slice_size) {|Array<AwsCftTools::Template>| ... } ⇒ Object

Iterates through the sorted list and yields an array of templates with no unsatisfied dependencies, up to the maximum slice size.

Parameters:

  • maximum_slice_size (Integer)

Yields:



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/aws_cft_tools/template_set/dependencies.rb', line 41

def each_slice(maximum_slice_size, &block)
  return unless block_given?
  # we want to start at the beginning and get up to <n> items for which all prior dependencies have
  # already been returned in a prior call
  state = EachSliceState.new(maximum_slice_size, &block)

  each do |template|
    state.add_template(template, @dependency_tree.dependencies_for(template.filename.to_s))
  end
  # catch the last templates
  state.process_slice
end

#linked(from, to) ⇒ Object



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

def linked(from, to)
  @dependency_tree.linked(from.filename.to_s, to.filename.to_s)
end

#provided(template, variable) ⇒ Object

Parameters:



14
15
16
# File 'lib/aws_cft_tools/template_set/dependencies.rb', line 14

def provided(template, variable)
  @dependency_tree.provided(template.filename.to_s, variable.to_s)
end

#required(template, variable) ⇒ Object

Parameters:



21
22
23
# File 'lib/aws_cft_tools/template_set/dependencies.rb', line 21

def required(template, variable)
  @dependency_tree.required(template.filename.to_s, variable.to_s)
end