Mercurial > repos > other > Puppet
comparison modules/stdlib/lib/puppet/parser/functions/values.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 # values.rb | 2 # values.rb |
3 # | 3 # |
4 module Puppet::Parser::Functions | 4 module Puppet::Parser::Functions |
5 newfunction(:values, :type => :rvalue, :doc => <<-DOC | 5 newfunction(:values, :type => :rvalue, :doc => <<-DOC |
6 When given a hash this function will return the values of that hash. | 6 @summary |
7 When given a hash this function will return the values of that hash. | |
7 | 8 |
8 *Examples:* | 9 @return |
10 array of values | |
9 | 11 |
10 $hash = { | 12 @example **Usage** |
11 'a' => 1, | 13 $hash = { |
12 'b' => 2, | 14 'a' => 1, |
13 'c' => 3, | 15 'b' => 2, |
14 } | 16 'c' => 3, |
15 values($hash) | 17 } |
18 values($hash) | |
16 | 19 |
17 This example would return: | 20 This example would return: ```[1,2,3]``` |
18 | 21 |
19 [1,2,3] | 22 > *Note:* |
20 DOC | 23 From Puppet 5.5.0, the compatible function with the same name in Puppet core |
24 will be used instead of this function. | |
25 | |
26 DOC | |
21 ) do |arguments| | 27 ) do |arguments| |
22 | 28 |
23 raise(Puppet::ParseError, "values(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty? | 29 raise(Puppet::ParseError, "values(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty? |
24 | 30 |
25 hash = arguments[0] | 31 hash = arguments[0] |