diff options
-rw-r--r-- | lib/set.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/set.rb b/lib/set.rb index 662b698b4e..4cba96e9e2 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -258,7 +258,9 @@ class Set # Replaces the elements with ones returned by collect(). def collect! block_given? or return enum_for(__method__) - replace(collect) + set = self.class.new + each { |o| set << yield(o) } + replace(set) end alias map! collect! |