diff options
author | Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> | 2011-04-29 04:36:28 +0100 |
---|---|---|
committer | Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> | 2011-04-29 04:36:28 +0100 |
commit | 65f98d2f09ab8fde4bcf81532d026c74f132e1e7 (patch) | |
tree | b11e042ba09498345dce7eb9ef152b45283680f2 /values.rb | |
parent | eab2a63f1bdd5478a9d6a5c5db71d6129cb79dcf (diff) | |
download | puppet-stdlib-65f98d2f09ab8fde4bcf81532d026c74f132e1e7.tar.gz puppet-stdlib-65f98d2f09ab8fde4bcf81532d026c74f132e1e7.tar.bz2 |
Adding relevant code.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Diffstat (limited to 'values.rb')
-rw-r--r-- | values.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/values.rb b/values.rb new file mode 100644 index 0000000..8e58184 --- /dev/null +++ b/values.rb @@ -0,0 +1,25 @@ +# +# values.rb +# + +module Puppet::Parser::Functions + newfunction(:values, :type => :rvalue, :doc => <<-EOS + EOS + ) do |arguments| + + raise(Puppet::ParseError, "values(): Wrong number of arguments " + + "given (#{arguments.size} for 1)") if arguments.size < 1 + + hash = arguments[0] + + if not hash.is_a?(Hash) + raise(Puppet::ParseError, 'values(): Requires a hash to work with') + end + + result = hash.values + + return result + end +end + +# vim: set ts=2 sw=2 et : |