Ruby

Ruby

Made by DeepSource

Use String#end_with? instead of a regex match anchored to the end of the string RB-PR1009

Performance
Major

Instead of searching for a string pattern at the end of a string using regex, it is more efficient to simply use end_with? instead.

Bad practice

'abc'.match(/bc$/)

Recommended

'abc'.end_with?('bc')