Class: Puppet::Parser::Scope::LocalScope

Inherits:
Ephemeral show all
Defined in:
lib/puppet/parser/scope.rb

Instance Attribute Summary

Attributes inherited from Ephemeral

#parent

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil) ⇒ LocalScope

Returns a new instance of LocalScope.



78
79
80
81
# File 'lib/puppet/parser/scope.rb', line 78

def initialize(parent=nil)
  super parent
  @symbols = {}
end

Instance Method Details

#[](name) ⇒ Object



83
84
85
86
87
88
89
# File 'lib/puppet/parser/scope.rb', line 83

def [](name)
  if @symbols.include?(name)
    @symbols[name]
  else
    super
  end
end

#[]=(name, value) ⇒ Object



95
96
97
# File 'lib/puppet/parser/scope.rb', line 95

def []=(name, value)
  @symbols[name] = value
end

#add_entries_to(target = {}) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/puppet/parser/scope.rb', line 111

def add_entries_to(target = {})
  super
  @symbols.each do |k, v|
    if v == :undef || v.nil?
      target.delete(k)
    else
      target[ k ] = v
    end
  end
  target
end

#bound?(name) ⇒ Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/puppet/parser/scope.rb', line 107

def bound?(name)
  @symbols.include?(name)
end

#delete(name) ⇒ Object



103
104
105
# File 'lib/puppet/parser/scope.rb', line 103

def delete(name)
  @symbols.delete(name)
end

#include?(name) ⇒ Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/puppet/parser/scope.rb', line 99

def include?(name)
  bound?(name) || super
end

#is_local_scope?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/puppet/parser/scope.rb', line 91

def is_local_scope?
  true
end