From 59cd24d41f1e6b5e25d35103c0720e8aa8cae0b6 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 4 Apr 2014 12:14:23 +0900 Subject: Hash#replace should copy default as well; close #2004 --- mrblib/hash.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mrblib') 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 -- cgit v1.2.3