4 module Puppet::Parser::Functions
5 newfunction(:rstrip, :type => :rvalue, :doc => <<-DOC
6 Strips leading spaces to the right of the string.
8 Note: from Puppet 6.0.0, the compatible function with the same name in Puppet core
9 will be used instead of this function.
13 raise(Puppet::ParseError, "rstrip(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
17 unless value.is_a?(Array) || value.is_a?(String)
18 raise(Puppet::ParseError, 'rstrip(): Requires either array or string to work with')
21 result = if value.is_a?(Array)
22 value.map { |i| i.is_a?(String) ? i.rstrip : i }
31 # vim: set ts=2 sw=2 et :