Puppet Function: validate_array_re
- Defined in:
-
puppet/modules/wmflib/lib/puppet/parser/functions/validate_array_re.rb
- Function type:
- Ruby 3.x API
Overview
validate_array_re() ⇒ Any
15
16
17
18
19
20
21
22
|
# File 'puppet/modules/wmflib/lib/puppet/parser/functions/validate_array_re.rb', line 15
newfunction(:validate_array_re, :arity => 2) do |args|
items, re = args
re = Regexp.new(re)
invalid = args.first.find { |item| item.to_s !~ re }
unless invalid.nil?
fail(Puppet::ParseError, "Array element \"#{invalid}\" does not match regular expression \"#{re.source}\".")
end
end
|