# class Hiera::Scope

### Attributes

real[R]

### Public Class Methods

new(real) click to toggle source

    # File lib/hiera/scope.rb, line 5
    def initialize(real)
      @real = real
    end

### Public Instance Methods

[](key) click to toggle source

    # File lib/hiera/scope.rb, line 9
    def [](key)
      if key == "calling_class"
        ans = @real.resource.name.to_s.downcase
      elsif key == "calling_module"
        ans = @real.resource.name.to_s.downcase.split("::").first
      else
        ans = @real.lookupvar(key)
      end

      # damn you puppet visual basic style variables.
      return nil if ans == ""
      return ans
    end

catalog() click to toggle source

    # File lib/hiera/scope.rb, line 29
    def catalog
      @real.catalog
    end

compiler() click to toggle source

    # File lib/hiera/scope.rb, line 37
    def compiler
      @real.compiler
    end

include?(key) click to toggle source

    # File lib/hiera/scope.rb, line 23
    def include?(key)
      return true if ["calling_class", "calling_module"].include?(key)

      return @real.lookupvar(key) != ""
    end

resource() click to toggle source

    # File lib/hiera/scope.rb, line 33
    def resource
      @real.resource
    end