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



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

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

Instance Method Details

#callable?(thing) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#model?(thing) ⇒ Boolean

Returns:

  • (Boolean)


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

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