Sha256: f50dd8b14f8bf88d931f949a9a386d862546ab164398fdae48bcb2b4ee011ba4

Contents?: true

Size: 469 Bytes

Versions: 2

Compression:

Stored size: 469 Bytes

Contents

# encoding: utf-8

require 'faraday'
require 'hashie'
require 'github_api2/mash'

module Github
  class Response::Mashify < Response
    define_parser do |body|
      ::Github::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

2 entries across 2 versions & 1 rubygems

Version Path
github_api2-1.0.1 lib/github_api2/response/mashify.rb
github_api2-1.0.0 lib/github_api2/response/mashify.rb