From 3766aa4cc574d9d5d49af7a126c8a2f2876b5ad2 Mon Sep 17 00:00:00 2001 From: knu Date: Wed, 6 Aug 2014 10:13:34 +0000 Subject: Implement Set#clone. [Fixes GH-661] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/set.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/set.rb') diff --git a/lib/set.rb b/lib/set.rb index 0d9870ccd7..db57594d0a 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 -- cgit v1.2.3