Class: BitBucket::Response::Mashify

Inherits:
BitBucket::Response show all
Defined in:
lib/bitbucket_rest_api/response/mashify.rb

Constant Summary

Constants inherited from BitBucket::Response

CONTENT_TYPE

Instance Method Summary collapse

Methods inherited from BitBucket::Response

define_parser, #parse_response?, #response_type

Instance Method Details

#parse(body) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/bitbucket_rest_api/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