comparison modules/stdlib/lib/puppet/parser/functions/unique.rb @ 275:d9352a684e62

Mass update of modules to remove deprecation warnings
author IBBoard <dev@ibboard.co.uk>
date Sun, 26 Jan 2020 11:36:07 +0000
parents c42fb28cff86
children
comparison
equal deleted inserted replaced
274:b2571c28fc27 275:d9352a684e62
1 # 1 #
2 # unique.rb 2 # unique.rb
3 # 3 #
4 module Puppet::Parser::Functions 4 module Puppet::Parser::Functions
5 newfunction(:unique, :type => :rvalue, :doc => <<-DOC 5 newfunction(:unique, :type => :rvalue, :doc => <<-DOC
6 This function will remove duplicates from strings and arrays. 6 @summary
7 This function will remove duplicates from strings and arrays.
7 8
8 *Examples:* 9 @return
10 String or array with duplicates removed
9 11
10 unique("aabbcc") 12 @example **Usage**
11 13
12 Will return: 14 unique("aabbcc")
15 Will return: abc
13 16
14 abc 17 You can also use this with arrays:
15 18
16 You can also use this with arrays: 19 unique(["a","a","b","b","c","c"])
20 This returns: ["a","b","c"]
17 21
18 unique(["a","a","b","b","c","c"])
19
20 This returns:
21
22 ["a","b","c"]
23 DOC 22 DOC
24 ) do |arguments| 23 ) do |arguments|
25 24
26 if Puppet::Util::Package.versioncmp(Puppet.version, '5.0.0') >= 0 25 if Puppet::Util::Package.versioncmp(Puppet.version, '5.0.0') >= 0
27 function_deprecation([:unique, 'This method is deprecated, please use the core puppet unique function. There is further documentation for the function in the release notes of Puppet 5.0.']) 26 function_deprecation([:unique, 'This method is deprecated, please use the core puppet unique function. There is further documentation for the function in the release notes of Puppet 5.0.'])