try_convert(obj) -> Hash | nilRuby 1.9.3 から[permalink][rdoc][edit][U, V] (_ToHash[U, V]) → ::Hash[U, V](untyped) → (::Hash[untyped, untyped] | nil)-
to_hash メソッドを用いて obj をハッシュに変換しようとします。
何らかの理由で変換できないときには nil を返します。このメソッドは引数がハッシュであるかどうかを調べるために使えます。
p Hash.try_convert({1=>2}) # => {1=>2} p Hash.try_convert("1=>2") # => nil