Sha256: c6bed46575478c5c8d75a72857f9e8001dd9e97897dd0e025c1965e4c1b54a8c

Contents?: true

Size: 759 Bytes

Versions: 18

Compression:

Stored size: 759 Bytes

Contents

class Hiera
  class Scope
    attr_reader :real

    def initialize(real)
      @real = real
    end

    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

    def include?(key)
      return true if ["calling_class", "calling_module"].include?(key)

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

    def catalog
      @real.catalog
    end

    def resource
      @real.resource
    end

    def compiler
      @real.compiler
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/hiera/scope.rb
puppet-3.1.1 lib/hiera/scope.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/hiera/scope.rb
puppet-3.1.0 lib/hiera/scope.rb
puppet-3.1.0.rc2 lib/hiera/scope.rb
puppet-3.1.0.rc1 lib/hiera/scope.rb
puppet-3.0.2 lib/hiera/scope.rb
puppet-3.0.2.rc3 lib/hiera/scope.rb
puppet-3.0.2.rc2 lib/hiera/scope.rb
puppet-3.0.2.rc1 lib/hiera/scope.rb
puppet-3.0.1 lib/hiera/scope.rb
puppet-3.0.1.rc1 lib/hiera/scope.rb
puppet-3.0.0 lib/hiera/scope.rb
puppet-3.0.0.rc8 lib/hiera/scope.rb
puppet-3.0.0.rc7 lib/hiera/scope.rb
hiera-puppet-1.0.0 lib/hiera/scope.rb
hiera-puppet-1.0.0rc3 lib/hiera/scope.rb
hiera-puppet-1.0.0rc2 lib/hiera/scope.rb