lib/securitytrails/response.rb in securitytrails-0.1.4 vs lib/securitytrails/response.rb in securitytrails-0.1.5
- old
+ new
@@ -3,9 +3,11 @@
require "ostruct"
module SecurityTrails
class Response < OpenStruct
def openstruct_to_hash(object, hash = {})
+ return object unless object.respond_to?(:each_pair)
+
object.each_pair do |key, value|
hash[key] = case value
when OpenStruct then openstruct_to_hash(value)
when Array then value.map { |v| openstruct_to_hash(v) }
else value