summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/delete_regex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/delete_regex.rb')
-rw-r--r--lib/puppet/parser/functions/delete_regex.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/puppet/parser/functions/delete_regex.rb b/lib/puppet/parser/functions/delete_regex.rb
index d72b3e9..e5dc1fd 100644
--- a/lib/puppet/parser/functions/delete_regex.rb
+++ b/lib/puppet/parser/functions/delete_regex.rb
@@ -1,5 +1,6 @@
#
-# delete_regex.rb
+# delete_regex.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
#
module Puppet::Parser::Functions
@@ -12,7 +13,7 @@ to be matched as an OR.
delete_regex(['a','b','c','b'], 'b')
Would return: ['a','c']
-
+
delete_regex(['a','b','c','b'], ['b', 'c'])
Would return: ['a']
@@ -25,8 +26,7 @@ to be matched as an OR.
EOS
) do |arguments|
- raise(Puppet::ParseError, "delete_regex(): Wrong number of arguments "+
- "given #{arguments.size} for 2") unless arguments.size == 2
+ raise(Puppet::ParseError, "delete_regex(): Wrong number of arguments given #{arguments.size} for 2") unless arguments.size == 2
collection = arguments[0].dup
Array(arguments[1]).each do |item|
@@ -34,8 +34,7 @@ to be matched as an OR.
when Array, Hash, String
collection.reject! { |coll_item| (coll_item =~ %r{\b#{item}\b}) }
else
- raise(TypeError, "delete_regex(): First argument must be an Array, " +
- "Hash, or String. Given an argument of class #{collection.class}.")
+ raise(TypeError, "delete_regex(): First argument must be an Array, Hash, or String. Given an argument of class #{collection.class}.")
end
end
collection