diff options
| author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-03 06:01:29 +0000 |
|---|---|---|
| committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-03 06:01:29 +0000 |
| commit | f5cca47b1ba9b243d626afaafc4e1249321674c3 (patch) | |
| tree | d74bff18680af6d591b0d444caf025458464faab /lib | |
| parent | 7386cb8789189a3c4fbbb960ca3bc7f8de331c91 (diff) | |
| download | ruby-f5cca47b1ba9b243d626afaafc4e1249321674c3.tar.gz ruby-f5cca47b1ba9b243d626afaafc4e1249321674c3.tar.xz ruby-f5cca47b1ba9b243d626afaafc4e1249321674c3.zip | |
* lib/set.rb (Set#collect, Set#select): Back out. I thought it
was consistent but turned out to be wrong.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/set.rb | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/lib/set.rb b/lib/set.rb index f73aceabb..662b698b4 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! |
