Sha256: dddc67ffa7bbd7f67a861cfedde34fbb94ef7f230afab6003b808a057080f2c7

Contents?: true

Size: 339 Bytes

Versions: 4

Compression:

Stored size: 339 Bytes

Contents

require 'faraday'

module Faraday
  class Response::ParseJson < Response::Middleware
    dependency 'multi_json'

    def parse(body)
      case body
      when nil
        nil
      when ''
        nil
      when 'true'
        true
      when 'false'
        false
      else
        ::MultiJson.decode(body)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
githu3-0.0.7 lib/faraday/response/parse_json.rb
githu3-0.0.6 lib/faraday/response/parse_json.rb
githu3-0.0.5 lib/faraday/response/parse_json.rb
githu3-0.0.4 lib/faraday/response/parse_json.rb