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