diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-21 03:26:49 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-21 03:26:49 +0900 |
| commit | d3ae793ef7d2f69666b0ee5fc4cd1d4178705c21 (patch) | |
| tree | e8e9fedc1c26abe31e3d640d30f35f8364ece32f | |
| parent | 34002374fceccc967debd8fb8825517e5c98a9a2 (diff) | |
| parent | 6cfc5795af507762adb16df78e86baa77ce62191 (diff) | |
| download | mruby-d3ae793ef7d2f69666b0ee5fc4cd1d4178705c21.tar.gz mruby-d3ae793ef7d2f69666b0ee5fc4cd1d4178705c21.zip | |
Merge pull request #1897 from suzukaze/add-enum-count-comment
Add Enumerable#count comment
| -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 |
