module Pundit

def self.included(base)

def self.included(base)
  location = caller_locations(1, 1).first
  warn <<~WARNING
    'include Pundit' is deprecated. Please use 'include Pundit::Authorization' instead.
     (called from #{location.label} at #{location.path}:#{location.lineno})
  WARNING
  base.include Authorization
end

def authorize(user, record, query, policy_class: nil, cache: nil)

Other tags:
    See: Pundit::Context#authorize -
def authorize(user, record, query, policy_class: nil, cache: nil)
  context = if cache
    policy_cache = CacheStore::LegacyStore.new(cache)
    Context.new(user: user, policy_cache: policy_cache)
  else
    Context.new(user: user)
  end
  context.authorize(record, query: query, policy_class: policy_class)
end

def policy(user, *args, **kwargs, &block)

Other tags:
    See: Pundit::Context#policy -
def policy(user, *args, **kwargs, &block)
  Context.new(user: user).policy(*args, **kwargs, &block)
end

def policy!(user, *args, **kwargs, &block)

Other tags:
    See: Pundit::Context#policy! -
def policy!(user, *args, **kwargs, &block)
  Context.new(user: user).policy!(*args, **kwargs, &block)
end

def policy_scope(user, *args, **kwargs, &block)

Other tags:
    See: Pundit::Context#policy_scope -
def policy_scope(user, *args, **kwargs, &block)
  Context.new(user: user).policy_scope(*args, **kwargs, &block)
end

def policy_scope!(user, *args, **kwargs, &block)

Other tags:
    See: Pundit::Context#policy_scope! -
def policy_scope!(user, *args, **kwargs, &block)
  Context.new(user: user).policy_scope!(*args, **kwargs, &block)
end