summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/function.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-12-02 16:26:54 -0600
committerLuke Kanies <luke@madstop.com>2008-12-02 16:26:54 -0600
commit99a9b5a045af6f1c68619792a45603cbe450652d (patch)
tree579963d464c0529d4e9250f937d495e415f1e867 /lib/puppet/parser/ast/function.rb
parentf73e13e7464edab73443857d628602b89361c220 (diff)
parent278bfe83015312292360f727d6532a143610db0d (diff)
downloadpuppet-99a9b5a045af6f1c68619792a45603cbe450652d.tar.gz
puppet-99a9b5a045af6f1c68619792a45603cbe450652d.tar.xz
puppet-99a9b5a045af6f1c68619792a45603cbe450652d.zip
Merge branch '0.24.x'
Conflicts: bin/puppetca lib/puppet/type/group.rb lib/puppet/type/tidy.rb lib/puppet/util/settings.rb Also edited the following files so tests will pass: lib/puppet/type/component.rb spec/unit/ssl/certificate_request.rb spec/unit/type/computer.rb spec/unit/type/mcx.rb spec/unit/type/resources.rb spec/unit/util/settings.rb spec/unit/util/storage.rb test/ral/type/zone.rb
Diffstat (limited to 'lib/puppet/parser/ast/function.rb')
-rw-r--r--lib/puppet/parser/ast/function.rb31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/puppet/parser/ast/function.rb b/lib/puppet/parser/ast/function.rb
index eb36fa906..fc3797f15 100644
--- a/lib/puppet/parser/ast/function.rb
+++ b/lib/puppet/parser/ast/function.rb
@@ -3,25 +3,17 @@ require 'puppet/parser/ast/branch'
class Puppet::Parser::AST
# An AST object to call a function.
class Function < AST::Branch
+
+ associates_doc
+
attr_accessor :name, :arguments
@settor = true
def evaluate(scope)
- # We don't need to evaluate the name, because it's plaintext
- args = @arguments.safeevaluate(scope)
-
- return scope.send("function_" + @name, args)
- end
-
- def initialize(hash)
- @ftype = hash[:ftype] || :rvalue
- hash.delete(:ftype) if hash.include? :ftype
-
- super(hash)
# Make sure it's a defined function
- unless @fname = Puppet::Parser::Functions.function(@name)
+ unless @fname
raise Puppet::ParseError, "Unknown function %s" % @name
end
@@ -42,6 +34,21 @@ class Puppet::Parser::AST
raise Puppet::DevError, "Invalid function type %s" % @ftype.inspect
end
+
+
+ # We don't need to evaluate the name, because it's plaintext
+ args = @arguments.safeevaluate(scope)
+
+ return scope.send("function_" + @name, args)
+ end
+
+ def initialize(hash)
+ @ftype = hash[:ftype] || :rvalue
+ hash.delete(:ftype) if hash.include? :ftype
+
+ super(hash)
+
+ @fname = Puppet::Parser::Functions.function(@name)
# Lastly, check the parity
end
end