Skip to content

Commit 449c26e

Browse files
committed
Calling ActiveSupport::Deprecation.warn no longer allowed. Instantiate and use module specific deprecator.
1 parent 6a4dd7b commit 449c26e

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

lib/arbo.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'active_support/core_ext/string/output_safety'
2-
require 'active_support/deprecation'
32
require 'active_support/hash_with_indifferent_access'
43
require 'active_support/inflector'
54

@@ -8,6 +7,7 @@ module Arbo
87

98
require 'arbo/element'
109
require 'arbo/context'
10+
require 'arbo/deprecator'
1111
require 'arbo/html/attributes'
1212
require 'arbo/html/class_list'
1313
require 'arbo/html/tag'

lib/arbo/deprecator.rb

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require 'active_support/deprecation'
2+
3+
module Arbo
4+
module_function
5+
def deprecator # :nodoc:
6+
@deprecator ||= ActiveSupport::Deprecation.new
7+
end
8+
end

lib/arbo/element.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ def inspect
137137
end
138138

139139
def to_str
140-
ActiveSupport::Deprecation.warn("don't rely on implicit conversion of Element to String")
140+
Arbo.deprecator.warn("don't rely on implicit conversion of Element to String")
141141
content
142142
end
143143

144144
def to_s
145-
ActiveSupport::Deprecation.warn("#render_in should be defined for rendering #{method_owner(:to_s)} instead of #to_s")
145+
Arbo.deprecator.warn("#render_in should be defined for rendering #{method_owner(:to_s)} instead of #to_s")
146146
content
147147
end
148148

@@ -158,7 +158,7 @@ def render_in_or_to_s(context)
158158
if method_distance(:render_in) <= method_distance(:to_s)
159159
render_in(context)
160160
else
161-
ActiveSupport::Deprecation.warn("#render_in should be defined for rendering #{method_owner(:to_s)} instead of #to_s")
161+
Arbo.deprecator.warn("#render_in should be defined for rendering #{method_owner(:to_s)} instead of #to_s")
162162
to_s.tap { |s| context.output_buffer << s }
163163
end
164164
end

0 commit comments

Comments
 (0)