mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2024-12-16 17:50:34 +00:00
16 lines
418 B
Ruby
16 lines
418 B
Ruby
module Puppet::Parser::Functions
|
|
newfunction(:pick_undef, :type => :rvalue, :doc => <<-EOS
|
|
This function is similar to pick_default, but will return or undefined values.
|
|
EOS
|
|
) do |args|
|
|
fail "Must receive at least one argument." if args.empty?
|
|
default = args.last
|
|
args = args[0..-2].compact
|
|
# args.delete(:undef)
|
|
# args.delete(:undefined)
|
|
# args.delete("")
|
|
args << default
|
|
return args[0]
|
|
end
|
|
end
|