summaryrefslogtreecommitdiff
path: root/join.rb
blob: b616e056fc8a7cdee9fe2a359a5f8070aa0a77f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
# join.rb
#

module Puppet::Parser::Functions
  newfunction(:join, :type => :rvalue, :doc => <<-EOS
    EOS
  ) do |arguments|

    array = arguments[0]

    suffix = arguments[1]
    prefix = arguments[2]

    if prefix and not prefix.empty?
      result = prefix + array.join(suffix + prefix)
    else
      result = array.join(suffix)
    end

    return result
  end
end

# vim: set ts=2 sw=2 et :