summaryrefslogtreecommitdiff
path: root/lib/set.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/set.rb')
-rw-r--r--lib/set.rb21
1 files changed, 1 insertions, 20 deletions
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!