From bc40b82f2c3258bd7ccb6d83d81dc7048564383e Mon Sep 17 00:00:00 2001 From: Kim Burgestrand Date: Wed, 9 Oct 2024 16:07:47 +0200 Subject: [PATCH] Deprecate Pundit::SUFFIX in favor of Pundit::PolicyFinder::SUFFIX It's only used by the PolicyFinder, so it belongs in there. --- CHANGELOG.md | 4 ++++ lib/pundit.rb | 4 +++- lib/pundit/policy_finder.rb | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b16cddbc..d83e138e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## Changed + +- Deprecated `Pundit::SUFFIX`, moved it to `Pundit::PolicyFinder::SUFFIX` (#835) + ## 2.4.0 (2024-08-26) ## Changed diff --git a/lib/pundit.rb b/lib/pundit.rb index a7263b39..4f143086 100644 --- a/lib/pundit.rb +++ b/lib/pundit.rb @@ -19,7 +19,9 @@ class Pundit::Error < StandardError; end # rubocop:disable Style/ClassAndModuleC # @api public module Pundit - SUFFIX = "Policy" + # @api private + # @deprecated See {Pundit::PolicyFinder} + SUFFIX = Pundit::PolicyFinder::SUFFIX # @api private # @private diff --git a/lib/pundit/policy_finder.rb b/lib/pundit/policy_finder.rb index ecc6e9bb..b63e7276 100644 --- a/lib/pundit/policy_finder.rb +++ b/lib/pundit/policy_finder.rb @@ -10,6 +10,9 @@ module Pundit # finder.scope #=> UserPolicy::Scope # class PolicyFinder + # @api private + SUFFIX = "Policy" + attr_reader :object # @param object [any] the object to find policy and scope classes for