module RefCheck
This module defines some methods for walking the reference tree of various objects.
Public Instance Methods
build_references(refs = [], origin = nil, method = :all_refs)
click to toggle source
Build up a set of references. rubocop:disable Metrics/CyclomaticComplexity
# File lib/cfndsl/ref_check.rb, line 14 def build_references(refs = [], origin = nil, method = :all_refs) if respond_to?(method) send(method).each do |ref| raise SelfReference, "#{origin} references itself at #{to_json}" if origin && ref.to_s == origin raise NullReference, "#{origin} contains null value reference at #{to_json}" if origin && ref.nil? refs << ref end end ref_children.each do |elem| # Nulls are not permitted in Cloudformation templates. raise NullReference, "#{origin} contains null value reference at #{to_json}" if origin && elem.nil? elem.build_references(refs, origin, method) if elem.respond_to?(:build_references) end refs end
ref_children()
click to toggle source
rubocop:enable Metrics/CyclomaticComplexity
# File lib/cfndsl/ref_check.rb, line 35 def ref_children [] end