Sha256: 82e82e60b92920fce8d2281d07da810d0f90f2cb506d02bc3fc2820a85a2a554

Contents?: true

Size: 502 Bytes

Versions: 11

Compression:

Stored size: 502 Bytes

Contents

# encoding: utf-8

require 'faraday'

module Github
  class Response::Jsonize < Response
    dependency 'multi_json'

    define_parser do |body|
      if MultiJson.respond_to?(:load)
        MultiJson.load body
      else
        MultiJson.decode body
      end
    end

    def parse(body)
      case body
      when ''
        nil
      when 'true'
        true
      when 'false'
        false
      else
        self.class.parser.call body
      end
    end
  end # Response::Jsonize
end # Github

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
github_api-0.6.5 lib/github_api/response/jsonize.rb
github_api-0.6.4 lib/github_api/response/jsonize.rb
github_api-0.6.3 lib/github_api/response/jsonize.rb
github_api-0.6.2 lib/github_api/response/jsonize.rb
github_api-0.6.1 lib/github_api/response/jsonize.rb
github_api-0.6.0 lib/github_api/response/jsonize.rb
github_api-0.5.4 lib/github_api/response/jsonize.rb
github_api-0.5.3 lib/github_api/response/jsonize.rb
github_api-0.5.2 lib/github_api/response/jsonize.rb
github_api-0.5.1 lib/github_api/response/jsonize.rb
github_api-0.5.0 lib/github_api/response/jsonize.rb