Sha256: 320878b02f2a9189b6ae5a005fad947cc6eb9c3749fff2f9566020d11ab48fe1

Contents?: true

Size: 513 Bytes

Versions: 14

Compression:

Stored size: 513 Bytes

Contents

require 'faraday_middleware/response/mashify'

module FaradayMiddleware
  # Public: Converts parsed response bodies to a Hashie::Rash if they were of
  # Hash or Array type.
  class Deashify < Mashify
    dependency do
      require 'desk/deash'
      self.mash_class = ::Hashie::Deash
    end

    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
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
desk-1.2.0 lib/faraday/response/deashify.rb
desk-1.1.1 lib/faraday/response/deashify.rb
desk-1.1.0 lib/faraday/response/deashify.rb
desk-1.0.10 lib/faraday/response/deashify.rb
desk-1.0.9 lib/faraday/response/deashify.rb
desk-1.0.8 lib/faraday/response/deashify.rb
desk-1.0.7 lib/faraday/response/deashify.rb
desk-1.0.6 lib/faraday/response/deashify.rb
desk-1.0.5 lib/faraday/response/deashify.rb
desk-1.0.4 lib/faraday/response/deashify.rb
desk-1.0.3 lib/faraday/response/deashify.rb
desk-1.0.2 lib/faraday/response/deashify.rb
desk-1.0.1 lib/faraday/response/deashify.rb
desk-1.0.0 lib/faraday/response/deashify.rb