method
from_hash
v2_5_5 -
Show latest stable
- Class:
JSON::GenericObject
from_hash(object)public
No documentation available.
# File ext/json/lib/json/generic_object.rb, line 21
def from_hash(object)
case
when object.respond_to?(:to_hash)
result = new
object.to_hash.each do |key, value|
result[key] = from_hash(value)
end
result
when object.respond_to?(:to_ary)
object.to_ary.map { |a| from_hash(a) }
else
object
end
end