Skip to content

Commit

Permalink
Make the ::Warning patch inactive if not configured
Browse files Browse the repository at this point in the history
Otherwise the warning merging functionality may conflict with
some other patches.
  • Loading branch information
byroot committed Jun 5, 2024
1 parent aa16cb9 commit af1a615
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/deprecation_toolkit/warning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ def deprecator
end
end
end
end

module DeprecationToolkit
module WarningPatch
def warn(str, *)
if Configuration.warnings_treated_as_deprecation.empty?
return super
end

str = DeprecationToolkit::Warning.handle_multipart(str)
return unless str

Expand All @@ -64,5 +66,5 @@ def warn(str, *)
end
ruby2_keywords :warn
end
::Warning.singleton_class.prepend(DeprecationToolkit::WarningPatch)
end
Warning.singleton_class.prepend(DeprecationToolkit::WarningPatch)

0 comments on commit af1a615

Please sign in to comment.