Current Path : /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/hiera/ |
Current File : //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/hiera/recursive_guard.rb |
# Allow for safe recursive lookup of values during variable interpolation. # # @api private class Hiera::InterpolationLoop < StandardError; end class Hiera::RecursiveGuard def initialize @seen = [] end def check(value, &block) if @seen.include?(value) raise Hiera::InterpolationLoop, "Lookup recursion detected in [#{@seen.join(', ')}]" end @seen.push(value) ret = yield @seen.pop ret end end