2 # is_function_available.rb
4 module Puppet::Parser::Functions
5 newfunction(:is_function_available, :type => :rvalue, :doc => <<-DOC
7 **Deprecated:** Determines whether the Puppet runtime has access to a function by that name.
9 This function accepts a string as an argument.
12 Returns `true` or `false`
14 > **Note:* **Deprecated** Will be removed in a future version of stdlib. See
15 [`validate_legacy`](#validate_legacy).
19 if arguments.size != 1
20 raise(Puppet::ParseError, "is_function_available?(): Wrong number of arguments given #{arguments.size} for 1")
23 # Only allow String types
24 return false unless arguments[0].is_a?(String)
26 function = Puppet::Parser::Functions.function(arguments[0].to_sym)
27 function.is_a?(String) && !function.empty?
31 # vim: set ts=2 sw=2 et :