module DeprecationToolkit::Warning

def deprecation_triggered?(str)

def deprecation_triggered?(str)
  DeprecationToolkit::Configuration.warnings_treated_as_deprecation.any? { |warning| warning === str }
end

def deprecator

def deprecator
  @deprecator ||= ActiveSupport::Deprecation.new("next", "DeprecationToolkit::Warning").tap do |deprecator|
    deprecator.behavior = :notify
    DeprecationSubscriber.attach_to(:deprecation_toolkit_warning)
  end
end

def handle_multipart(str)

def handle_multipart(str)
  if @buffer
    str = @buffer + str
    @buffer = nil
    return str
  end
  if two_part_warning?(str)
    @buffer = str
    return
  end
  str
end

def two_part_warning?(str)

/path/to/calleee.rb:1: warning: The called method `method_name' is defined here
/path/to/caller.rb:1: warning: Passing the keyword argument as the last hash parameter is deprecated

/path/to/calleee.rb:1: warning: The called method `method_name' is defined here
maybe ** should be added to the call
/path/to/caller.rb:1: warning: Using the last argument as keyword parameters is deprecated; \

Example:
Ruby 2.7 has two warnings for improper use of keyword arguments that are sent in two parts
def two_part_warning?(str)
  str.end_with?(
    "maybe ** should be added to the call\n",
    "Passing the keyword argument as the last hash parameter is deprecated\n",
  )
end