class RuboCop::Cop::Performance::DeletePrefix

def on_send(node)

rubocop:disable Metrics/AbcSize
def on_send(node)
  return unless (receiver, bad_method, regexp_str, replace_string = delete_prefix_candidate?(node))
  return unless replace_string.empty?
  good_method = PREFERRED_METHODS[bad_method]
  message = format(MSG, current: bad_method, prefer: good_method)
  add_offense(node.loc.selector, message: message) do |corrector|
    regexp_str = drop_start_metacharacter(regexp_str)
    regexp_str = interpret_string_escapes(regexp_str)
    string_literal = to_string_literal(regexp_str)
    new_code = "#{receiver.source}#{node.loc.dot.source}#{good_method}(#{string_literal})"
    corrector.replace(node, new_code)
  end
end