From f5f48d9400420617fa8bee3b53075894b3a53c1c Mon Sep 17 00:00:00 2001 From: Sayed Abdelhaleem Date: Wed, 27 Jan 2016 21:17:33 +0200 Subject: protect NoMethodError from calling to_hash in replace --- mrblib/hash.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'mrblib/hash.rb') 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| -- cgit v1.2.3