1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-11-14 01:00:34 +00:00
puppet-rsnapshot/lib/puppet/parser/functions/pick_undef.rb

16 lines
418 B
Ruby
Raw Normal View History

2015-12-19 10:16:05 +00:00
module Puppet::Parser::Functions
newfunction(:pick_undef, :type => :rvalue, :doc => <<-EOS
This function is similar to pick_default, but will return or undefined values.
2015-12-19 10:16:05 +00:00
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