diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-06 10:13:34 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-06 10:13:34 +0000 |
commit | 3766aa4cc574d9d5d49af7a126c8a2f2876b5ad2 (patch) | |
tree | ee9603666869cd3606420090dc24b9dee301b5e0 /lib | |
parent | 4d5fceb08681e77570dd66f7fbc483ec853a2d47 (diff) | |
download | ruby-3766aa4cc574d9d5d49af7a126c8a2f2876b5ad2.tar.gz |
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')
-rw-r--r-- | lib/set.rb | 11 |
1 files changed, 9 insertions, 2 deletions
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 |