Sha256: d530e2d6ed7a55b87258e7765b1d52b49affe5b6be39bc0f9ce337ff522d843b

Contents?: true

Size: 455 Bytes

Versions: 73

Compression:

Stored size: 455 Bytes

Contents

# encoding: utf-8

require 'faraday'

module Github
  class Response::Mashify < Response
    dependency 'hashie/mash'

    define_parser do |body|
      ::Hashie::Mash.new body
    end

    def parse(body)
      case body
      when Hash
        self.class.parser.call body
      when Array
        body.map { |item| item.is_a?(Hash) ? self.class.parser.call(item) : item }
      else
        body
      end
    end
  end # Response::Mashify
end # Github

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
github_api-0.14.5 lib/github_api/response/mashify.rb
github_api-0.14.4 lib/github_api/response/mashify.rb
github_api-0.14.3 lib/github_api/response/mashify.rb
github_api-0.14.2 lib/github_api/response/mashify.rb
github_api-0.14.1 lib/github_api/response/mashify.rb
github_api-0.14.0 lib/github_api/response/mashify.rb
github_api-0.13.1 lib/github_api/response/mashify.rb
github_api-0.13.0 lib/github_api/response/mashify.rb
github_api-0.12.4 lib/github_api/response/mashify.rb
github_api-0.12.3 lib/github_api/response/mashify.rb
github_api-0.12.2 lib/github_api/response/mashify.rb
github_api-0.12.1 lib/github_api/response/mashify.rb
github_api-0.12.0 lib/github_api/response/mashify.rb
github_api-0.11.3 lib/github_api/response/mashify.rb
github_api-0.11.2 lib/github_api/response/mashify.rb
github_api-0.11.1 lib/github_api/response/mashify.rb
github_api-0.11.0 lib/github_api/response/mashify.rb
github_api-0.10.2 lib/github_api/response/mashify.rb
github_api-0.10.1 lib/github_api/response/mashify.rb
github_api-0.10.0 lib/github_api/response/mashify.rb