X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fdsa-puppet.git;a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fdelete_values.rb;h=f1625228ada151062a004fe4fb2f5a1a816ef88e;hp=f98f247f9b7d1f7dc6c9324c44b12c42fb13b022;hb=30caaa85aed7015ca0d77216bff175eebd917eb7;hpb=6f656bd4265e3dab13b9af2bf96e9044322e9d8f diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/delete_values.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/delete_values.rb index f98f247f9..f1625228a 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/delete_values.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/delete_values.rb @@ -3,20 +3,22 @@ # module Puppet::Parser::Functions newfunction(:delete_values, :type => :rvalue, :doc => <<-DOC - Deletes all instances of a given value from a hash. + @summary + Deletes all instances of a given value from a hash. - *Examples:* + @example Example usage - delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B') + delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B') + Would return: {'a'=>'A','c'=>'C','B'=>'D'} - Would return: {'a'=>'A','c'=>'C','B'=>'D'} + > *Note:* + Since Puppet 4.0.0 the equivalent can be performed with the + built-in [`filter`](https://puppet.com/docs/puppet/latest/function.html#filter) function: + $array.filter |$val| { $val != 'B' } + $hash.filter |$key, $val| { $val != 'B' } - Note that since Puppet 4.0.0 the equivalent can be performed with the filter() function in Puppet: - - $array.filter |$val| { $val != 'B' } - $hash.filter |$key, $val| { $val != 'B' } - - DOC + @return [Hash] The given hash now missing all instances of the targeted value + DOC ) do |arguments| raise(Puppet::ParseError, "delete_values(): Wrong number of arguments given (#{arguments.size} of 2)") if arguments.size != 2