Skip to content
Browse files

Merge pull request #1234 from gzohari/pr-merge-bang-check-type

Add type check in Hash#merge!
  • Loading branch information...
2 parents f568b49 + 17eef07 commit 11e70f2191caecfe546f8a97baf284c1cfc25e00 @matz matz committed May 5, 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 11e70f2

Please sign in to comment.
Something went wrong with that request. Please try again.