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.4.6 lib/github_api/response/mashify.rb
github_api-0.4.5 lib/github_api/response/mashify.rb
github_api-0.4.4 lib/github_api/response/mashify.rb
github_api-0.4.3 lib/github_api/response/mashify.rb
github_api-0.4.2 lib/github_api/response/mashify.rb
github_api-0.4.1 lib/github_api/response/mashify.rb
github_api-0.4.0 lib/github_api/response/mashify.rb
github_api-0.3.9 lib/github_api/response/mashify.rb
github_api-0.3.8 lib/github_api/response/mashify.rb
github_api-0.3.7 lib/github_api/response/mashify.rb
github_api-0.3.6 lib/github_api/response/mashify.rb
github_api-0.3.4 lib/github_api/response/mashify.rb
github_api-0.3.3 lib/github_api/response/mashify.rb