From 6cfc5795af507762adb16df78e86baa77ce62191 Mon Sep 17 00:00:00 2001 From: Jun Hiroe Date: Fri, 21 Mar 2014 00:44:00 +0900 Subject: Add Enumerable#count comment --- mrbgems/mruby-enum-ext/mrblib/enum.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mrbgems/mruby-enum-ext/mrblib/enum.rb b/mrbgems/mruby-enum-ext/mrblib/enum.rb index 4be807640..c0f0ea3f2 100644 --- a/mrbgems/mruby-enum-ext/mrblib/enum.rb +++ b/mrbgems/mruby-enum-ext/mrblib/enum.rb @@ -210,6 +210,16 @@ module Enumerable end end + ## + # call-seq: + # enum.count -> int + # enum.count(item) -> int + # enum.count { |obj| block } -> int + # + # Returns the number of items in +enum+ through enumeration. + # If an argument is given, the number of items in +enum+ that + # are equal to +item+ are counted. If a block is given, it + # counts the number of elements yielding a true value. def count(v=NONE, &block) count = 0 if block -- cgit v1.2.3