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 " +
19 "given (#{arguments.size} for 1)") if arguments.size < 1
24 unless [Array, String].include?(klass)
25 raise(Puppet::ParseError, 'strip(): Requires either ' +
26 'array or string to work with')
30 result = value.collect { |i| i.is_a?(String) ? i.strip : i }
39 # vim: set ts=2 sw=2 et :