summaryrefslogtreecommitdiff
path: root/lib/set.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-10-27 16:03:07 -0700
committerJeremy Evans <code@jeremyevans.net>2020-06-11 14:02:00 -0700
commita6cf2f3d22a78aeae9d7f36cc78a195deb686705 (patch)
tree30a4c537185f3d6fd0fb435f6d981569d30b5e84 /lib/set.rb
parente100fcbdd1e81c23e3b4c87964aff210232903a8 (diff)
Make mutating the result of SortedSet#to_a not affect the set
Fixes [Bug #15834]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3215
Diffstat (limited to 'lib/set.rb')
-rw-r--r--lib/set.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/set.rb b/lib/set.rb
index b8ab6ab..d405d81 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -778,7 +778,7 @@ class SortedSet < Set
def to_a
(@keys = @hash.keys).sort! unless @keys
- @keys
+ @keys.dup
end
def freeze