Class: GraphQL::ScopeHelper

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

Overview

Defines ‘scope` helper

Instance Method Summary collapse

Constructor Details

#initialize(before_or_after, deprecated: false) ⇒ ScopeHelper

Returns a new instance of ScopeHelper.



37
38
39
40
# File 'lib/graphql-pundit.rb', line 37

def initialize(before_or_after, deprecated: false)
  @before_or_after = before_or_after
  @deprecated = deprecated
end

Instance Method Details

#call(defn, proc = :infer_scope) ⇒ Object



42
43
44
45
46
47
# File 'lib/graphql-pundit.rb', line 42

def call(defn, proc = :infer_scope)
  opts = {proc: proc, deprecated: @deprecated}
  Define::InstanceDefinable::AssignMetadataKey.
    new(:"#{@before_or_after}_scope").
    call(defn, opts)
end