diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2008-11-26 23:18:45 +0100 |
---|---|---|
committer | Brice Figureau <brice-puppet@daysofwonder.com> | 2008-11-29 12:00:16 +0100 |
commit | d8c741f9d3b07b11f11af0765d740d9e78889794 (patch) | |
tree | 90147b4efdda84b8dbb92975cfc8881c2b9ee025 /lib/puppet | |
parent | 3c4efa7ec2043043d72d325e67fe5bd6098e0413 (diff) | |
download | puppet-d8c741f9d3b07b11f11af0765d740d9e78889794.tar.gz puppet-d8c741f9d3b07b11f11af0765d740d9e78889794.tar.xz puppet-d8c741f9d3b07b11f11af0765d740d9e78889794.zip |
Fix #1741 - Puppet::Parser::Functions rmfunctions and unit test
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/parser/functions.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb index 5fb0439da..b1cd0d083 100644 --- a/lib/puppet/parser/functions.rb +++ b/lib/puppet/parser/functions.rb @@ -54,6 +54,20 @@ module Functions end end + # Remove a function added by newfunction + def self.rmfunction(name) + name = symbolize(name) + + unless @functions.include? name + raise Puppet::DevError, "Function %s is not defined" % name + end + + @functions.delete(name) + + fname = "function_" + name.to_s + Puppet::Parser::Scope.send(:remove_method, fname) + end + # Determine if a given name is a function def self.function(name) name = symbolize(name) |