diff --git a/CHANGELOG.md b/CHANGELOG.md index 93ad1f8c..405d759e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Changed - Using `permit` matcher without a surrouding `permissions` block now raises a useful error. (#834) +- Explicitly require less of `active_support` (#834) ## 2.4.0 (2024-08-26) diff --git a/lib/pundit.rb b/lib/pundit.rb index 85292526..d56349b3 100644 --- a/lib/pundit.rb +++ b/lib/pundit.rb @@ -1,12 +1,9 @@ # frozen_string_literal: true +require "active_support" + require "pundit/version" require "pundit/policy_finder" -require "active_support/concern" -require "active_support/core_ext/string/inflections" -require "active_support/core_ext/object/blank" -require "active_support/core_ext/module/introspection" -require "active_support/dependencies/autoload" require "pundit/authorization" require "pundit/context" require "pundit/cache_store/null_store" diff --git a/lib/pundit/policy_finder.rb b/lib/pundit/policy_finder.rb index b63e7276..e1884dd5 100644 --- a/lib/pundit/policy_finder.rb +++ b/lib/pundit/policy_finder.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +# String#safe_constantize, String#demodulize, String#underscore, String#camelize +require "active_support/core_ext/string/inflections" + module Pundit # Finds policy and scope classes for given object. # @api public diff --git a/lib/pundit/rspec.rb b/lib/pundit/rspec.rb index 4e9c5654..c5e488aa 100644 --- a/lib/pundit/rspec.rb +++ b/lib/pundit/rspec.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +# Array#to_sentence +require "active_support/core_ext/array/conversions" + module Pundit module RSpec module Matchers diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1282d64c..a1953057 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,8 +9,7 @@ require "pundit" require "pundit/rspec" -require "active_support" -require "active_model" +require "active_model/naming" # Load all supporting files: models, policies, etc. require "zeitwerk" @@ -20,3 +19,5 @@ loader.push_dir(File.expand_path("support/lib", __dir__)) loader.setup loader.eager_load + +puts $LOADED_FEATURES.grep(%r{active_support/core_ext}).join("\n")