Sha256: 84deb82a71f95382ba7b0fdde77be3eeb06e03937b6ec90ba53a3661991ce35c
Contents?: true
Size: 568 Bytes
Versions: 5
Compression:
Stored size: 568 Bytes
Contents
require 'faraday' module FaradayMiddleware class Mashify < Faraday::Response::Middleware class << self attr_accessor :mash_class end dependency do require 'hashie/mash' self.mash_class = ::Hashie::Mash end def parse(body) case body when Hash self.class.mash_class.new(body) when Array body.map { |item| item.is_a?(Hash) ? self.class.mash_class.new(item) : item } else body end end end end # deprecated alias Faraday::Response::Mashify = FaradayMiddleware::Mashify
Version data entries
5 entries across 5 versions & 2 rubygems