5 module Puppet::Parser::Functions
6 newfunction(:strip, :type => :rvalue, :doc => <<-EOS
7 This function removes leading and trailing whitespace from a string or from
8 every string inside an array.
14 Would result in: "aaa"
18 raise(Puppet::ParseError, "strip(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size < 1
22 unless value.is_a?(Array) || value.is_a?(String)
23 raise(Puppet::ParseError, 'strip(): Requires either array or string to work with')
27 result = value.collect { |i| i.is_a?(String) ? i.strip : i }
36 # vim: set ts=2 sw=2 et :