#
# intersection.rb
#
-
module Puppet::Parser::Functions
- newfunction(:intersection, :type => :rvalue, :doc => <<-EOS
-This function returns an array of the intersection of two.
-
-*Examples:*
+ newfunction(:intersection, :type => :rvalue, :doc => <<-DOC
+ This function returns an array of the intersection of two.
- intersection(["a","b","c"],["b","c","d"]) # returns ["b","c"]
- intersection(["a","b","c"],[1,2,3,4]) # returns [] (true, when evaluated as a Boolean)
+ *Examples:*
- EOS
- ) do |arguments|
+ intersection(["a","b","c"],["b","c","d"]) # returns ["b","c"]
+ intersection(["a","b","c"],[1,2,3,4]) # returns [] (true, when evaluated as a Boolean)
+ DOC
+ ) do |arguments|
# Two arguments are required
raise(Puppet::ParseError, "intersection(): Wrong number of arguments given (#{arguments.size} for 2)") if arguments.size != 2