Sha256: efa7557d4b7e614b9af60bb0ffe8b89ff9adc1d2adaa43e67a61e6d23dad5c89

Contents?: true

Size: 493 Bytes

Versions: 2

Compression:

Stored size: 493 Bytes

Contents

module Giraph
  module Remote
    # Dummy Hash-wrapper to enable precise `instance_of?` checks
    # Allows us to differentiate JSON responses that are
    # coming from remote GraphQL interface vs regular Hash objects
    # including all nested hashes within a response.
    class Response < Hash
      # Factory method to encapsulate special parsing logic
      def self.from_json(raw_json)
        JSON.parse(raw_json, symbolize_names: true, object_class: self)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
giraph-0.1.1 lib/giraph/remote/response.rb
giraph-0.1.0 lib/giraph/remote/response.rb