[前][次][番号順一覧][スレッド一覧]

ruby-changes:28775

From: knu <ko1@a...>
Date: Sun, 19 May 2013 17:33:45 +0900 (JST)
Subject: [ruby-changes:28775] knu:r40827 (trunk): * lib/set.rb (Set#delete_if, Set#keep_if): Add comments.

knu	2013-05-19 17:33:27 +0900 (Sun, 19 May 2013)

  New Revision: 40827

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40827

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

  Modified files:
    trunk/ChangeLog
    trunk/lib/set.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40826)
+++ ChangeLog	(revision 40827)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May 19 17:29:07 2013  Akinori MUSHA  <knu@i...>
+
+	* lib/set.rb (Set#delete_if, Set#keep_if): Add comments.
+
 Sun May 19 11:37:36 2013  Kazuki Tsujimoto  <kazuki@c...>
 
 	* ext/fiddle/extconf.rb: ignore rc version of libffi to fix build failure.
Index: lib/set.rb
===================================================================
--- lib/set.rb	(revision 40826)
+++ lib/set.rb	(revision 40827)
@@ -272,6 +272,8 @@ class Set https://github.com/ruby/ruby/blob/trunk/lib/set.rb#L272
   # true, and returns self.
   def delete_if
     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))
     self
   end
@@ -280,6 +282,8 @@ class Set https://github.com/ruby/ruby/blob/trunk/lib/set.rb#L282
   # false, and returns self.
   def keep_if
     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))
     self
   end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]