diff --git a/lib/arbo.rb b/lib/arbo.rb index 4d056ae..34a8373 100644 --- a/lib/arbo.rb +++ b/lib/arbo.rb @@ -1,5 +1,4 @@ require 'active_support/core_ext/string/output_safety' -require 'active_support/deprecation' require 'active_support/hash_with_indifferent_access' require 'active_support/inflector' @@ -8,6 +7,7 @@ module Arbo require 'arbo/element' require 'arbo/context' +require 'arbo/deprecator' require 'arbo/html/attributes' require 'arbo/html/class_list' require 'arbo/html/tag' diff --git a/lib/arbo/deprecator.rb b/lib/arbo/deprecator.rb new file mode 100644 index 0000000..bba93d9 --- /dev/null +++ b/lib/arbo/deprecator.rb @@ -0,0 +1,8 @@ +require 'active_support/deprecation' + +module Arbo + module_function + def deprecator # :nodoc: + @deprecator ||= ActiveSupport::Deprecation.new + end +end diff --git a/lib/arbo/element.rb b/lib/arbo/element.rb index 2334396..1568ddc 100644 --- a/lib/arbo/element.rb +++ b/lib/arbo/element.rb @@ -137,12 +137,12 @@ def inspect end def to_str - ActiveSupport::Deprecation.warn("don't rely on implicit conversion of Element to String") + Arbo.deprecator.warn("don't rely on implicit conversion of Element to String") content end def to_s - ActiveSupport::Deprecation.warn("#render_in should be defined for rendering #{method_owner(:to_s)} instead of #to_s") + Arbo.deprecator.warn("#render_in should be defined for rendering #{method_owner(:to_s)} instead of #to_s") content end @@ -158,7 +158,7 @@ def render_in_or_to_s(context) if method_distance(:render_in) <= method_distance(:to_s) render_in(context) else - ActiveSupport::Deprecation.warn("#render_in should be defined for rendering #{method_owner(:to_s)} instead of #to_s") + Arbo.deprecator.warn("#render_in should be defined for rendering #{method_owner(:to_s)} instead of #to_s") to_s.tap { |s| context.output_buffer << s } end end