Sha256: bd2d535ba753a0609d3bd9bab593dcdca53b5b5570e004a244ba88945eb98aa7

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true
require 'faraday'

module BitBucket
  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 # BitBucket

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitbuckets-0.2.0 lib/bitbucket_rest_api/response/mashify.rb