summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/scope.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-08-18 11:47:40 -0500
committerLuke Kanies <luke@madstop.com>2008-08-18 11:47:40 -0500
commite3971b9751141cd448a8197da024be43581f6dcd (patch)
tree3ae780db3d9dae0a4df10ec24f928bf3a844e749 /lib/puppet/parser/scope.rb
parent025edc5c3737f476119df4bab73ebdc68be19430 (diff)
parent2ec4e298c3274abc8eaad4230bca8d39a48d2e35 (diff)
downloadpuppet-e3971b9751141cd448a8197da024be43581f6dcd.tar.gz
puppet-e3971b9751141cd448a8197da024be43581f6dcd.tar.xz
puppet-e3971b9751141cd448a8197da024be43581f6dcd.zip
Merge branch '0.24.x'
Conflicts: CHANGELOG test/util/posixtest.rb
Diffstat (limited to 'lib/puppet/parser/scope.rb')
-rw-r--r--lib/puppet/parser/scope.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index a6e43e7b3..32b127a6b 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -183,6 +183,25 @@ class Puppet::Parser::Scope
end
end
+ # Return a hash containing our variables and their values, optionally (and
+ # by default) including the values defined in our parent. Local values
+ # shadow parent values.
+ def to_hash(recursive = true)
+ if recursive and parent then
+ target = parent.to_hash(recursive)
+ end
+ target ||= Hash.new
+ @symtable.keys.each { |name|
+ value = @symtable[name]
+ if value == :undef then
+ target.delete(name)
+ else
+ target[name] = value
+ end
+ }
+ return target
+ end
+
def namespaces
@namespaces.dup
end