class Tinder::FaradayResponse::WithIndifferentAccess

Public Class Methods

register_on_complete(env) click to toggle source
# File lib/tinder/faraday_response.rb, line 36
def self.register_on_complete(env)
  env[:response].on_complete do |response|
    json = response[:body]
    if json.is_a?(Hash)
      response[:body] = ::HashWithIndifferentAccess.new(json)
    elsif json.is_a?(Array) and json.first.is_a?(Hash)
      response[:body] = json.map{|item| ::HashWithIndifferentAccess.new(item) }
    end
  end
end