Module: GraphQL::Pundit::Common

Defined in:
lib/graphql-pundit/common.rb

Overview

Common methods used for authorization and scopes

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



16
17
18
19
# File 'lib/graphql-pundit/common.rb', line 16

def self.included(base)
  @current_user = :current_user
  base.extend(ClassMethods)
end

Instance Method Details

#callable?(thing) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/graphql-pundit/common.rb', line 21

def callable?(thing)
  thing.respond_to?(:call)
end

#model?(thing) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/graphql-pundit/common.rb', line 25

def model?(thing)
  thing.respond_to?(:model)
end

#object?(thing) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/graphql-pundit/common.rb', line 29

def object?(thing)
  thing.respond_to?(:object)
end