1 module Puppet::Parser::Functions
2 newfunction(:max, :type => :rvalue, :doc => <<-EOS
3 Returns the highest value of all arguments.
4 Requires at least one argument.
8 raise(Puppet::ParseError, "max(): Wrong number of arguments " +
9 "need at least one") if args.size == 0
11 # Sometimes we get numbers as numerics and sometimes as strings.
12 # We try to compare them as numbers when possible
13 return args.max do |a,b|
14 if a.to_s =~ /\A-?\d+(.\d+)?\z/ and b.to_s =~ /\A-?\d+(.\d+)?\z/ then