Sha256: ca585f871b1cfc0d38bb6ee8424484c048c900baa67ed10baae2ee81f1195c6e
Contents?: true
Size: 575 Bytes
Versions: 1
Compression:
Stored size: 575 Bytes
Contents
require 'faraday' module Smartdc module Response 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 rescue body end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smartdc-0.4.0 | lib/smartdc/response/mashify.rb |