Class: GraphQL::Pundit::Instrumenters::Scope::ScopeResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql-pundit/instrumenters/scope.rb

Overview

Applies the scoping to the passed object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_user, scope, old_resolver, field) ⇒ ScopeResolver

Returns a new instance of ScopeResolver.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/graphql-pundit/instrumenters/scope.rb', line 14

def initialize(current_user, scope, old_resolver, field)
  @current_user = current_user
  @old_resolver = old_resolver
  @field = field

  unless valid_value?(scope)
    raise ArgumentError, 'Invalid value passed to `scope`'
  end

  @scope = scope
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user.



12
13
14
# File 'lib/graphql-pundit/instrumenters/scope.rb', line 12

def current_user
  @current_user
end

#fieldObject (readonly)

Returns the value of attribute field.



12
13
14
# File 'lib/graphql-pundit/instrumenters/scope.rb', line 12

def field
  @field
end

#old_resolverObject (readonly)

Returns the value of attribute old_resolver.



12
13
14
# File 'lib/graphql-pundit/instrumenters/scope.rb', line 12

def old_resolver
  @old_resolver
end

#scopeObject (readonly)

Returns the value of attribute scope.



12
13
14
# File 'lib/graphql-pundit/instrumenters/scope.rb', line 12

def scope
  @scope
end