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

ruby-changes:5273

From: knu <ko1@a...>
Date: Tue, 3 Jun 2008 15:01:42 +0900 (JST)
Subject: [ruby-changes:5273] Ruby:r16772 (trunk): * lib/set.rb (Set#collect, Set#select): Back out. I thought it

knu	2008-06-03 15:01:29 +0900 (Tue, 03 Jun 2008)

  New Revision: 16772

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

  Log:
    * lib/set.rb (Set#collect, Set#select): Back out.  I thought it
      was consistent but turned out to be wrong.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16772&r2=16771&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/set.rb?r1=16772&r2=16771&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 16771)
+++ ChangeLog	(revision 16772)
@@ -1,3 +1,8 @@
+Tue Jun  3 15:00:22 2008  Akinori MUSHA  <knu@i...>
+
+	* lib/set.rb (Set#collect, Set#select): Back out.  I thought it
+	  was consistent but turned out to be wrong.
+
 Tue Jun  3 13:41:08 2008  Akinori MUSHA  <knu@i...>
 
 	* lib/set.rb (Set#collect, Set#select): Override Enumerable
Index: lib/set.rb
===================================================================
--- lib/set.rb	(revision 16771)
+++ lib/set.rb	(revision 16772)
@@ -255,32 +255,13 @@
     self
   end
 
-  # Calls the given block once for each element and returns a new set
-  # containing the values returned by the block.
-  def collect
-    block_given? or return enum_for(__method__)
-    set = self.class.new
-    each { |o| set << yield(o) }
-  end
-  alias map collect
-
-  # Replaces the values with ones returned by collect().
+  # Replaces the elements with ones returned by collect().
   def collect!
     block_given? or return enum_for(__method__)
     replace(collect)
   end
   alias map! collect!
 
-  # Calls the given block once for each element and returns a new set
-  # containing those elements for which the block returns a true
-  # value.
-  def select
-    block_given? or return enum_for(__method__)
-    set = self.class.new
-    each { |o| set << o if yield(o) }
-    set
-  end
-
   # Equivalent to Set#delete_if, but returns nil if no changes were
   # made.
   def reject!

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

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