diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-15 05:37:38 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-15 05:37:38 +0000 |
commit | 9f2e41b7e0be219e1db219dbc31f4a0a8c892809 (patch) | |
tree | 345eba1b0bf5645074c92ab18619aaf526fea516 /lib/set.rb | |
parent | bab5bf0c79ba310eb2606c079315de417a3cccc9 (diff) | |
download | ruby-9f2e41b7e0be219e1db219dbc31f4a0a8c892809.tar.gz |
* lib/set.rb: Make Set#each and SortedSet#each generate a sized
enumerator. [GH-931] by kachick (Kenichi Kamiya)
* test/test_set.rb: Import tests from Set into SortedSet. [GH-931]
by kachick (Kenichi Kamiya)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/set.rb')
-rw-r--r-- | lib/set.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/set.rb b/lib/set.rb index 59d70e82ca..d612fdcb92 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -284,7 +284,7 @@ class Set # the element as parameter. Returns an enumerator if no block is # given. def each(&block) - block or return enum_for(__method__) + block or return enum_for(__method__) { size } @hash.each_key(&block) self end @@ -663,7 +663,7 @@ class SortedSet < Set end def each(&block) - block or return enum_for(__method__) + block or return enum_for(__method__) { size } to_a.each(&block) self end |