Puppet Function: array_substract

Defined in:
lib/puppet/parser/functions/array_substract.rb
Function type:
Ruby 3.x API

Overview

array_substract()Any

Returns:

  • (Any)


3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/puppet/parser/functions/array_substract.rb', line 3

newfunction(:array_substract, :type => :rvalue) do |args|
  raise Puppet::ParseError, "array_substract(): requires 2 arguments, got #{args.length}" if args.length != 2
  first = args.shift
  second = args.shift

  raise Puppet::ParseError, "array_substract(): First argument is not an array" unless first.is_a?(Array)
  raise Puppet::ParseError, "array_substract(): Second argument is not an array or string" unless (second.is_a?(Array) or second.is_a?(String))

  second = [second] unless second.is_a?(Array)


  first - second
end