Sha256: dbe164a9e7297cdac45abb509facac14ad86ffdffca29ae604686d7e0d5fab72

Contents?: true

Size: 541 Bytes

Versions: 2

Compression:

Stored size: 541 Bytes

Contents

module GraphQL
  module ResultCache
    class Callback
      def initialize obj:, args:, ctx:, value:
        @obj = obj
        @args = args
        @ctx = ctx
        @value = value
      end

      def call result_hash
        case @value
          when Symbol
            @obj.public_send(@value, result_hash)
          when Proc
            @value.call(result_hash, @obj, @args, @ctx)
        end
        ::GraphQL::ResultCache.logger&.debug "GraphQL result cache callback called for #{@ctx.path.join('.')}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql-result_cache-0.1.3 lib/graphql/result_cache/callback.rb
graphql-result_cache-0.1.2 lib/graphql/result_cache/callback.rb