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
# File 'lib/puppet/parser/scope.rb', line 83

def [](name)
  val = @symbols[name]
  val.nil? && !@symbols.include?(name) ? super : val
end

#[]=(name, value) ⇒ Object



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

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

#add_entries_to(target = {}, include_undef = false) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/puppet/parser/scope.rb', line 108

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

#bound?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#delete(name) ⇒ Object



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

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

#include?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#is_local_scope?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/puppet/parser/scope.rb', line 88

def is_local_scope?
  true
end