Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / values.rb
1 #
2 # values.rb
3 #
4 module Puppet::Parser::Functions
5   newfunction(:values, :type => :rvalue, :doc => <<-DOC
6     When given a hash this function will return the values of that hash.
7
8     *Examples:*
9
10         $hash = {
11           'a' => 1,
12           'b' => 2,
13           'c' => 3,
14         }
15         values($hash)
16
17     This example would return:
18
19         [1,2,3]
20
21     Note: from Puppet 5.5.0, the compatible function with the same name in Puppet core
22     will be used instead of this function.
23     DOC
24              ) do |arguments|
25
26     raise(Puppet::ParseError, "values(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
27
28     hash = arguments[0]
29
30     unless hash.is_a?(Hash)
31       raise(Puppet::ParseError, 'values(): Requires hash to work with')
32     end
33
34     result = hash.values
35
36     return result
37   end
38 end
39
40 # vim: set ts=2 sw=2 et :