diff options
author | Ken Barber <ken@bob.sh> | 2011-07-28 21:30:02 +0100 |
---|---|---|
committer | Ken Barber <ken@bob.sh> | 2011-07-28 21:30:02 +0100 |
commit | 7d6ae5d57ce45ff1293f02b90c816a7f938a3af6 (patch) | |
tree | 864177f1ce94abe0a8874f5b107cd6dce6b3e005 /lib/puppet/parser/functions | |
parent | 4915eff575801e73ab15a77b500eb2e0d42b579c (diff) | |
download | puppet-stdlib-7d6ae5d57ce45ff1293f02b90c816a7f938a3af6.tar.gz puppet-stdlib-7d6ae5d57ce45ff1293f02b90c816a7f938a3af6.tar.bz2 |
Count functionality overlaps with size - so removing it.
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r-- | lib/puppet/parser/functions/count.rb | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/lib/puppet/parser/functions/count.rb b/lib/puppet/parser/functions/count.rb deleted file mode 100644 index c4e2283..0000000 --- a/lib/puppet/parser/functions/count.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -# count.rb -# - -# TODO(Krzysztof Wilczynski): We need to add support for regular expression ... -# TODO(Krzysztof Wilczynski): Support for hash values would be nice too ... - -module Puppet::Parser::Functions - newfunction(:count, :type => :rvalue, :doc => <<-EOS - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "count(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, Hash, String].include?(klass) - raise(Puppet::ParseError, 'count(): Requires either ' + - 'array, hash or string to work with') - end - - item = arguments[1] if arguments[1] - - value = value.is_a?(Hash) ? value.keys : value - - # No item to look for and count? Then just return current size ... - result = item ? value.count(item) : value.size - - return result - end -end - -# vim: set ts=2 sw=2 et : |