diff options
-rw-r--r-- | lib/puppet/parser/functions/get_default.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/get_default.rb b/lib/puppet/parser/functions/get_default.rb new file mode 100644 index 0000000..3f4359b --- /dev/null +++ b/lib/puppet/parser/functions/get_default.rb @@ -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 |