Permalink
Browse files

add type check in Hash#merge!

  • Loading branch information...
1 parent 7d134d9 commit 17eef070da74f51a4bf6ac53d0dd58042ec4eb6c @gzohari committed May 3, 2013
Showing with 1 addition and 0 deletions.
  1. +1 −0 mrbgems/mruby-hash-ext/mrblib/hash.rb
View
1 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]

0 comments on commit 17eef07

Please sign in to comment.