Class: FaradayMiddleware::Deashify

Inherits:
Mashify
  • Object
show all
Defined in:
lib/faraday/response/deashify.rb

Overview

Public: Converts parsed response bodies to a Hashie::Rash if they were of Hash or Array type.

Instance Method Summary collapse

Instance Method Details

#parse(body) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/faraday/response/deashify.rb', line 12

def parse(body)
  case body
  when Hash
    raw = mash_class.new({:raw => body})
  when Array
    raw = body.map { |item| parse(item) }
  else
    raw = body
  end
end