class Hiera::Scope

Constants

CALLING_CLASS
CALLING_MODULE
MODULE_NAME

Attributes

real[R]

Public Instance Methods

[](key) click to toggle source
# File lib/hiera/scope.rb, line 13
def [](key)
  if key == CALLING_CLASS
    ans = find_hostclass(@real)
  elsif key == CALLING_MODULE
    ans = @real.lookupvar(MODULE_NAME)
  else
    ans = @real.lookupvar(key)
  end

  if ans.nil? or ans == ""
    nil
  else
    ans
  end
end
catalog() click to toggle source
# File lib/hiera/scope.rb, line 37
def catalog
  @real.catalog
end
compiler() click to toggle source
# File lib/hiera/scope.rb, line 45
def compiler
  @real.compiler
end
include?(key) click to toggle source
# File lib/hiera/scope.rb, line 29
def include?(key)
  if key == CALLING_CLASS or key == CALLING_MODULE
    true
  else
    @real.lookupvar(key) != ""
  end
end
resource() click to toggle source
# File lib/hiera/scope.rb, line 41
def resource
  @real.resource
end

Public Class Methods

new(real) click to toggle source
# File lib/hiera/scope.rb, line 9
def initialize(real)
  @real = real
end