1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/set.rb (Set#delete_if, Set#keep_if): Add comments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2013-05-19 08:33:27 +00:00
parent b4795cdbba
commit 11c7566aa3
2 changed files with 8 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Sun May 19 17:29:07 2013 Akinori MUSHA <knu@iDaemons.org>
* lib/set.rb (Set#delete_if, Set#keep_if): Add comments.
Sun May 19 11:37:36 2013 Kazuki Tsujimoto <kazuki@callcc.net> Sun May 19 11:37:36 2013 Kazuki Tsujimoto <kazuki@callcc.net>
* ext/fiddle/extconf.rb: ignore rc version of libffi to fix build failure. * ext/fiddle/extconf.rb: ignore rc version of libffi to fix build failure.

View file

@ -272,6 +272,8 @@ class Set
# true, and returns self. # true, and returns self.
def delete_if def delete_if
block_given? or return enum_for(__method__) block_given? or return enum_for(__method__)
# @hash.delete_if should be faster, but using it breaks the order
# of enumeration in subclasses.
select(&proc).each(&@hash.method(:delete)) select(&proc).each(&@hash.method(:delete))
self self
end end
@ -280,6 +282,8 @@ class Set
# false, and returns self. # false, and returns self.
def keep_if def keep_if
block_given? or return enum_for(__method__) block_given? or return enum_for(__method__)
# @hash.keep_if should be faster, but using it breaks the order of
# enumeration in subclasses.
reject(&proc).each(&@hash.method(:delete)) reject(&proc).each(&@hash.method(:delete))
self self
end end