Skip to content

Commit b2bc006

Browse files
Add ActionText.deprecator
This commit adds `ActionText.deprecator`, and adds it to `Rails.application.deprecators` so that it can be configured via settings such as `config.active_support.report_deprecations`.
1 parent f434310 commit b2bc006

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

actiontext/lib/action_text.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
require "active_support"
44
require "active_support/rails"
55

6+
require "action_text/deprecator"
7+
68
require "nokogiri"
79

810
module ActionText
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
module ActionText
4+
def self.deprecator # :nodoc:
5+
@deprecator ||= ActiveSupport::Deprecation.new
6+
end
7+
end

actiontext/lib/action_text/engine.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ class Engine < Rails::Engine
1919
#{root}/app/models
2020
)
2121

22+
initializer "action_text.deprecator" do |app|
23+
app.deprecators[:action_text] = ActionText.deprecator
24+
end
25+
2226
initializer "action_text.attribute" do
2327
ActiveSupport.on_load(:active_record) do
2428
include ActionText::Attribute

railties/test/application/configuration_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3895,6 +3895,7 @@ def new(app); self; end
38953895
assert_equal ActionDispatch.deprecator, Rails.application.deprecators[:action_dispatch]
38963896
assert_equal ActionMailbox.deprecator, Rails.application.deprecators[:action_mailbox]
38973897
assert_equal ActionMailer.deprecator, Rails.application.deprecators[:action_mailer]
3898+
assert_equal ActionText.deprecator, Rails.application.deprecators[:action_text]
38983899
assert_equal ActionView.deprecator, Rails.application.deprecators[:action_view]
38993900
assert_equal ActiveJob.deprecator, Rails.application.deprecators[:active_job]
39003901
assert_equal ActiveRecord.deprecator, Rails.application.deprecators[:active_record]

0 commit comments

Comments
 (0)