diff options
| author | Gilad Zohari <[email protected]> | 2013-05-03 23:36:02 +0300 |
|---|---|---|
| committer | Gilad Zohari <[email protected]> | 2013-05-03 23:36:02 +0300 |
| commit | 17eef070da74f51a4bf6ac53d0dd58042ec4eb6c (patch) | |
| tree | 8f9a433c5b8e7c97fa00b8fd103dcaa25b28f6d9 | |
| parent | 7d134d941b37e0aaa8f6c6630583b091f70b8354 (diff) | |
| download | mruby-17eef070da74f51a4bf6ac53d0dd58042ec4eb6c.tar.gz mruby-17eef070da74f51a4bf6ac53d0dd58042ec4eb6c.zip | |
add type check in Hash#merge!
| -rw-r--r-- | mrbgems/mruby-hash-ext/mrblib/hash.rb | 1 |
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] |
