summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-01-28 12:17:51 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-01-28 12:17:51 +0900
commitc35a25c51e2e576d12ebd155397e8dc91e3759d5 (patch)
tree4d08f9594cee3a4ac9a414bcf0bafcd048ba5c49 /mrblib
parent2723b10a01d5a1f50c174a6ec50582ae798aa9ae (diff)
parentf5f48d9400420617fa8bee3b53075894b3a53c1c (diff)
downloadmruby-c35a25c51e2e576d12ebd155397e8dc91e3759d5.tar.gz
mruby-c35a25c51e2e576d12ebd155397e8dc91e3759d5.zip
Merge pull request #3091 from visualsayed/fix_hash_replace_method
protect NoMethodError from calling to_hash in replace
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/hash.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/mrblib/hash.rb b/mrblib/hash.rb
index e3e709070..782111459 100644
--- a/mrblib/hash.rb
+++ b/mrblib/hash.rb
@@ -154,6 +154,7 @@ class Hash
#
# ISO 15.2.13.4.23
def replace(hash)
+ raise TypeError, "can't convert argument into Hash" unless hash.respond_to?(:to_hash)
self.clear
hash = hash.to_hash
hash.each_key{|k|