diff --git a/lib/rubocop/cop/packaging/require_with_relative_path.rb b/lib/rubocop/cop/packaging/require_with_relative_path.rb index 198a12e..d9d004f 100644 --- a/lib/rubocop/cop/packaging/require_with_relative_path.rb +++ b/lib/rubocop/cop/packaging/require_with_relative_path.rb @@ -73,8 +73,7 @@ def on_send(node) # Called from on_send, this method helps to replace # the "bad" require call with the "good" one. def good_require_call - bad_part = @str.match(%r{.*/lib/}).to_s - good_call = @str.delete_prefix(bad_part) + good_call = @str.sub(%r{^.*/lib/}, "") %(require "#{good_call}") end