diff options
Diffstat (limited to 'lib/set.rb')
-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 05eb3ffb2a..b668738ebb 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -378,7 +378,9 @@ class Set # Returns an enumerator if no block is given. def collect! block_given? or return enum_for(__method__) { size } - replace(self.class.new(self) { |o| yield(o) }) + set = self.class.new + each { |o| set << yield(o) } + replace(set) end alias map! collect! |