summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-03 06:01:29 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-03 06:01:29 +0000
commit489bf84b9f95f45e6f1b232403f02939a93d159d (patch)
treed74bff18680af6d591b0d444caf025458464faab
parentea40df71fcd67a1fa16205299ac25c803ab331e2 (diff)
* lib/set.rb (Set#collect, Set#select): Back out. I thought it
was consistent but turned out to be wrong. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/set.rb21
2 files changed, 6 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c85a33392..82b4cc4d96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jun 3 15:00:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * 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@iDaemons.org>
* lib/set.rb (Set#collect, Set#select): Override Enumerable
diff --git a/lib/set.rb b/lib/set.rb
index f73aceabbc..662b698b4e 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -255,32 +255,13 @@ class Set
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!