Sha256: 4563ffaf1e732296bb63d7841f3fc2e0890f0ed7918e24d2531f143750ec6bf6

Contents?: true

Size: 420 Bytes

Versions: 21

Compression:

Stored size: 420 Bytes

Contents

# 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, "Detected in [#{@seen.join(', ')}]"
    end
    @seen.push(value)
    ret = yield
    @seen.pop
    ret
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
hiera-3.0.6 lib/hiera/recursive_guard.rb
hiera-3.0.6-x86-mingw32 lib/hiera/recursive_guard.rb
hiera-3.0.6-x64-mingw32 lib/hiera/recursive_guard.rb
hiera-3.0.5 lib/hiera/recursive_guard.rb
hiera-3.0.5-x86-mingw32 lib/hiera/recursive_guard.rb
hiera-3.0.5-x64-mingw32 lib/hiera/recursive_guard.rb
hiera-3.0.1 lib/hiera/recursive_guard.rb
hiera-3.0.1-x86-mingw32 lib/hiera/recursive_guard.rb
hiera-3.0.1-x64-mingw32 lib/hiera/recursive_guard.rb
hiera-2.0.0 lib/hiera/recursive_guard.rb
hiera-2.0.0-x86-mingw32 lib/hiera/recursive_guard.rb
hiera-2.0.0-x64-mingw32 lib/hiera/recursive_guard.rb
hiera-1.3.4 lib/hiera/recursive_guard.rb
hiera-1.3.3 lib/hiera/recursive_guard.rb
hiera-1.3.2 lib/hiera/recursive_guard.rb
hiera-1.3.2.rc2 lib/hiera/recursive_guard.rb
hiera-1.3.2.rc1 lib/hiera/recursive_guard.rb
hiera-1.3.1 lib/hiera/recursive_guard.rb
hiera-1.3.1.rc1 lib/hiera/recursive_guard.rb
hiera-1.3.0 lib/hiera/recursive_guard.rb