4 module Puppet::Parser::Functions
5 newfunction(:reverse, :type => :rvalue, :doc => <<-DOC
7 Reverses the order of a string or array.
10 reversed string or array
12 > *Note:* that the same can be done with the reverse_each() function in Puppet.
16 raise(Puppet::ParseError, "reverse(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
20 unless value.is_a?(Array) || value.is_a?(String)
21 raise(Puppet::ParseError, 'reverse(): Requires either array or string to work with')
24 result = value.reverse
30 # vim: set ts=2 sw=2 et :