Sha256: 60571d3fbaf0e95e0b3e16fbb38ed85c28ae9fdc0d71e3ed9598b427fc33e4d0

Contents?: true

Size: 619 Bytes

Versions: 5

Compression:

Stored size: 619 Bytes

Contents

# frozen_string_literal: true

require 'pundit'
require_relative 'scope'

module GraphQL
  module Pundit
    module Instrumenters
      # Instrumenter that supplies `after_scope`
      class AfterScope < Scope
        SCOPE_KEY = :after_scope

        # Applies the scoping to the passed object
        class ScopeResolver < ScopeResolver
          def call(root, arguments, context)
            resolver_result = old_resolver.call(root, arguments, context)
            scope_proc = new_scope(scope)
            scope_proc.call(resolver_result, arguments, context)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
graphql-pundit2-1 lib/graphql-pundit/instrumenters/after_scope.rb
graphql-pundit2-0.9.1 lib/graphql-pundit/instrumenters/after_scope.rb
graphql-pundit-387-0.7.1 lib/graphql-pundit/instrumenters/after_scope.rb
graphql-pundit-0.7.1 lib/graphql-pundit/instrumenters/after_scope.rb
graphql-pundit-0.6.0 lib/graphql-pundit/instrumenters/after_scope.rb