diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2016-04-12 10:41:48 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2016-04-12 10:41:48 -0700 |
commit | 733508677dbafe3e48bf170342d2f4ee0f1c3201 (patch) | |
tree | 6ec20e4e1e0485018b2b70980f9257fc2af5994e /lib | |
parent | e3a6e2c601416ed7c656ccaf75eaec967f4eb687 (diff) | |
parent | 0d46515b57cea60d4d5f1e4d81a75a448a7a73a8 (diff) |
Merge pull request #591 from jyaworski/delete_regex
Add support for regular expressions to delete
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/delete.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/delete.rb b/lib/puppet/parser/functions/delete.rb index f548b44..8435163 100644 --- a/lib/puppet/parser/functions/delete.rb +++ b/lib/puppet/parser/functions/delete.rb @@ -2,8 +2,6 @@ # delete.rb # -# TODO(Krzysztof Wilczynski): We need to add support for regular expression ... - module Puppet::Parser::Functions newfunction(:delete, :type => :rvalue, :doc => <<-EOS Deletes all instances of a given element from an array, substring from a @@ -34,7 +32,7 @@ string, or key from a hash. Array(arguments[1]).each do |item| case collection when Array, Hash - collection.delete item + collection.delete_if { |coll_item| coll_item =~ %r{#{item}} } when String collection.gsub! item, '' else |