diff options
| author | Jun Hiroe <[email protected]> | 2014-03-21 00:44:00 +0900 |
|---|---|---|
| committer | Jun Hiroe <[email protected]> | 2014-03-21 00:44:00 +0900 |
| commit | 6cfc5795af507762adb16df78e86baa77ce62191 (patch) | |
| tree | 319621929348f4284a50d40c9bdade3903dda66f /mrbgems/mruby-enum-ext | |
| parent | 36836c8eb9add532ae09357b6862c33e6af86a04 (diff) | |
| download | mruby-6cfc5795af507762adb16df78e86baa77ce62191.tar.gz mruby-6cfc5795af507762adb16df78e86baa77ce62191.zip | |
Add Enumerable#count comment
Diffstat (limited to 'mrbgems/mruby-enum-ext')
| -rw-r--r-- | mrbgems/mruby-enum-ext/mrblib/enum.rb | 10 |
1 files changed, 10 insertions, 0 deletions
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 |
