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 /keys.rb | |
parent | eab2a63f1bdd5478a9d6a5c5db71d6129cb79dcf (diff) |
Adding relevant code.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Diffstat (limited to 'keys.rb')
-rw-r--r-- | keys.rb | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +# +# keys.rb +# + +module Puppet::Parser::Functions + newfunction(:keys, :type => :rvalue, :doc => <<-EOS + EOS + ) do |arguments| + + raise(Puppet::ParseError, "keys(): 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, 'keys(): Requires a hash to work with') + end + + result = hash.keys + + return result + end +end + +# vim: set ts=2 sw=2 et : |