summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
authorKen Barber <ken@bob.sh>2011-07-28 21:30:02 +0100
committerKen Barber <ken@bob.sh>2011-07-28 21:30:02 +0100
commit7d6ae5d57ce45ff1293f02b90c816a7f938a3af6 (patch)
tree864177f1ce94abe0a8874f5b107cd6dce6b3e005 /lib/puppet/parser/functions
parent4915eff575801e73ab15a77b500eb2e0d42b579c (diff)
Count functionality overlaps with size - so removing it.
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/count.rb36
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 :