# File lib/puppet/parser/functions.rb, line 27
27:     def self.newfunction(name, options = {}, &block)
28:         name = symbolize(name)
29: 
30:         if @functions.include? name
31:             raise Puppet::DevError, "Function %s already defined" % name
32:         end
33: 
34:         # We want to use a separate, hidden module, because we don't want
35:         # people to be able to call them directly.
36:         unless defined? FCollection
37:             eval("module FCollection; end")
38:         end
39: 
40:         ftype = options[:type] || :statement
41: 
42:         unless ftype == :statement or ftype == :rvalue
43:             raise Puppet::DevError, "Invalid statement type %s" % ftype.inspect
44:         end
45: 
46:         fname = "function_" + name.to_s
47:         Puppet::Parser::Scope.send(:define_method, fname, &block)
48: 
49:         # Someday we'll support specifying an arity, but for now, nope
50:         #@functions[name] = {:arity => arity, :type => ftype}
51:         @functions[name] = {:type => ftype, :name => fname}
52:         if options[:doc]
53:             @functions[name][:doc] = options[:doc]
54:         end
55:     end