summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-hash-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-05-05 22:49:21 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-05-05 22:49:21 -0700
commit11e70f2191caecfe546f8a97baf284c1cfc25e00 (patch)
tree81383b477512be73239de8744a25eb3f52b25ca7 /mrbgems/mruby-hash-ext
parentf568b49ef489ebb74252428ff9c07d00d624ed03 (diff)
parent17eef070da74f51a4bf6ac53d0dd58042ec4eb6c (diff)
downloadmruby-11e70f2191caecfe546f8a97baf284c1cfc25e00.tar.gz
mruby-11e70f2191caecfe546f8a97baf284c1cfc25e00.zip
Merge pull request #1234 from gzohari/pr-merge-bang-check-type
Add type check in Hash#merge!
Diffstat (limited to 'mrbgems/mruby-hash-ext')
-rw-r--r--mrbgems/mruby-hash-ext/mrblib/hash.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb
index 3e1bac0a2..3fb83abba 100644
--- a/mrbgems/mruby-hash-ext/mrblib/hash.rb
+++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb
@@ -1,5 +1,6 @@
class Hash
def merge!(other, &block)
+ raise "can't convert argument into Hash" unless other.respond_to?(:to_hash)
if block
other.each_key{|k|
self[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]