Class: SecurityTrails::Response
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- SecurityTrails::Response
- Defined in:
- lib/securitytrails/response.rb
Instance Method Summary collapse
Instance Method Details
#openstruct_to_hash(object, hash = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/securitytrails/response.rb', line 7 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 end end hash end |
#to_h ⇒ Object
20 21 22 |
# File 'lib/securitytrails/response.rb', line 20 def to_h openstruct_to_hash(self) end |