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%2Fgrep.rb;h=2d274838ed6dd2b99bc40b554071c87b35ba2c64;hp=b6881bf365229b79b3b4b363b48fbceeea51a8e0;hb=30caaa85aed7015ca0d77216bff175eebd917eb7;hpb=6f656bd4265e3dab13b9af2bf96e9044322e9d8f diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/grep.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/grep.rb index b6881bf36..2d274838e 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/grep.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/grep.rb @@ -3,20 +3,19 @@ # module Puppet::Parser::Functions newfunction(:grep, :type => :rvalue, :doc => <<-DOC - This function searches through an array and returns any elements that match - the provided regular expression. - - *Examples:* - - grep(['aaa','bbb','ccc','aaaddd'], 'aaa') - - Would return: - - ['aaa','aaaddd'] - - Note that since Puppet 4.0.0, the filter() function in Puppet can do the same: - - ['aaa', 'bbb', 'ccc', 'aaaddd']. filter |$x| { $x =~ 'aaa' } + @summary + This function searches through an array and returns any elements that match + the provided regular expression. + + @return + array of elements that match the provided regular expression. + @example Example Usage: + grep(['aaa','bbb','ccc','aaaddd'], 'aaa') # Returns ['aaa','aaaddd'] + + > **Note:** that since Puppet 4.0.0, the built-in + [`filter`](https://puppet.com/docs/puppet/latest/function.html#filter) function does + the "same" - as any logic can be used to filter, as opposed to just regular expressions: + ```['aaa', 'bbb', 'ccc', 'aaaddd']. filter |$x| { $x =~ 'aaa' }``` DOC ) do |arguments|