Fix Hash.try_convert.

This commit is contained in:
Akinori MUSHA 2013-04-15 09:33:47 +09:00
parent 94d28bdfbb
commit 03627aa42a

View file

@ -16,7 +16,7 @@ class Hash
class << self
def try_convert(object)
if object.is_a?(Hash) ||
(object.respond_to?(:to_h) && (object = object.to_str).is_a?(Hash))
(object.respond_to?(:to_hash) && (object = object.to_hash).is_a?(Hash))
object
else
nil