add a get_default function

This commit is contained in:
o 2014-10-09 13:32:52 +02:00
parent 16951d51b1
commit e9d8147584

View file

@ -0,0 +1,15 @@
# get_default($value, $default) : $value
#
# return $value || $default.
module Puppet::Parser::Functions
newfunction(:get_default, :type => :rvalue) do |args|
value = nil
args.each { |x|
if ! x.nil? and x.length > 0
value = x
break
end
}
return value
end
end