Class: Github::Response::Mashify

Inherits:
Github::Response
  • Object
show all
Defined in:
lib/github_api2/response/mashify.rb

Constant Summary

Constants inherited from Github::Response

CONTENT_TYPE

Instance Method Summary collapse

Methods inherited from Github::Response

define_parser, #initialize, #parse_body?, #parse_response?, #parse_response_type?, #process_body, #response_type

Constructor Details

This class inherits a constructor from Github::Response

Instance Method Details

#parse(body) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/github_api2/response/mashify.rb', line 13

def parse(body)
  case body
  when Hash
    self.class.parser.call body
  when Array
    body.map { |item| item.is_a?(Hash) ? self.class.parser.call(item) : item }
  else
    body
  end
end