X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Freverse.rb;h=8b97a97311afaf25b5500159d670b4ce9e653f8a;hb=30caaa85aed7015ca0d77216bff175eebd917eb7;hp=7f1018f677697f2a37cbbf09a0ce33f0266d9805;hpb=ad88f67c13ae0f1a08936dad643f1e3509ab5f40;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/reverse.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/reverse.rb index 7f1018f67..8b97a9731 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/reverse.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/reverse.rb @@ -1,21 +1,24 @@ # # reverse.rb # - module Puppet::Parser::Functions - newfunction(:reverse, :type => :rvalue, :doc => <<-EOS -Reverses the order of a string or array. - EOS - ) do |arguments| + newfunction(:reverse, :type => :rvalue, :doc => <<-DOC + @summary + Reverses the order of a string or array. + + @return + reversed string or array + + > *Note:* that the same can be done with the reverse_each() function in Puppet. + DOC + ) do |arguments| - raise(Puppet::ParseError, "reverse(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 + raise(Puppet::ParseError, "reverse(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty? value = arguments[0] unless value.is_a?(Array) || value.is_a?(String) - raise(Puppet::ParseError, 'reverse(): Requires either ' + - 'array or string to work with') + raise(Puppet::ParseError, 'reverse(): Requires either array or string to work with') end result = value.reverse