4 module Puppet::Parser::Functions
5 newfunction(:join, :type => :rvalue, :doc => <<-DOC
7 **Deprecated:** This function joins an array into a string using a separator.
9 @example Example Usage:
10 join(['a','b','c'], ",") # Results in: "a,b,c"
13 The String containing each of the array values
15 > **Note:** **Deprecated** from Puppet 5.4.0 this function has been replaced
16 with a built-in [`join`](https://puppet.com/docs/puppet/latest/function.html#join) function.
20 # Technically we support two arguments but only first is mandatory ...
21 raise(Puppet::ParseError, "join(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
25 unless array.is_a?(Array)
26 raise(Puppet::ParseError, 'join(): Requires array to work with')
29 suffix = arguments[1] if arguments[1]
32 unless suffix.is_a?(String)
33 raise(Puppet::ParseError, 'join(): Requires string to work with')
37 result = suffix ? array.join(suffix) : array.join
43 # vim: set ts=2 sw=2 et :