summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-04-04 12:14:23 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-04 12:14:23 +0900
commit59cd24d41f1e6b5e25d35103c0720e8aa8cae0b6 (patch)
treec7d96eddbe8b171d59f17f58bd0542037b114221 /mrblib
parent9f6d69ee562cecb597ab02b2b716e3d773141f17 (diff)
downloadmruby-59cd24d41f1e6b5e25d35103c0720e8aa8cae0b6.tar.gz
mruby-59cd24d41f1e6b5e25d35103c0720e8aa8cae0b6.zip
Hash#replace should copy default as well; close #2004
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/hash.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/mrblib/hash.rb b/mrblib/hash.rb
index 6fae521a8..e608d2971 100644
--- a/mrblib/hash.rb
+++ b/mrblib/hash.rb
@@ -152,6 +152,11 @@ class Hash
hash.each_key{|k|
self[k] = hash[k]
}
+ if hash.default_proc
+ self.default_proc = hash.default_proc
+ elsif hash.default
+ self.default = hash.default
+ end
self
end
# ISO 15.2.13.4.17