summaryrefslogtreecommitdiff
path: root/lib/set.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-06 10:13:34 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-06 10:13:34 +0000
commit3766aa4cc574d9d5d49af7a126c8a2f2876b5ad2 (patch)
treeee9603666869cd3606420090dc24b9dee301b5e0 /lib/set.rb
parent4d5fceb08681e77570dd66f7fbc483ec853a2d47 (diff)
Implement Set#clone. [Fixes GH-661]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/set.rb')
-rw-r--r--lib/set.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/set.rb b/lib/set.rb
index 0d9870c..db57594 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -100,11 +100,18 @@ class Set
end
private :do_with_enum
- # Copy internal hash.
- def initialize_copy(orig)
+ # Dup internal hash.
+ def initialize_dup(orig)
+ super
@hash = orig.instance_variable_get(:@hash).dup
end
+ # Clone internal hash.
+ def initialize_clone(orig)
+ super
+ @hash = orig.instance_variable_get(:@hash).clone
+ end
+
def freeze # :nodoc:
@hash.freeze
super