lib/rubocop/cop/performance/end_with.rb in rubocop-performance-1.8.1 vs lib/rubocop/cop/performance/end_with.rb in rubocop-performance-1.9.0
- old
+ new
@@ -45,9 +45,10 @@
include RegexpMetacharacter
extend AutoCorrector
MSG = 'Use `String#end_with?` instead of a regex match anchored to ' \
'the end of the string.'
+ RESTRICT_ON_SEND = %i[match =~ match?].freeze
def_node_matcher :redundant_regex?, <<~PATTERN
{(send $!nil? {:match :=~ :match?} (regexp (str $#literal_at_end?) (regopt)))
(send (regexp (str $#literal_at_end?) (regopt)) {:match :match?} $_)
(match-with-lvasgn (regexp (str $#literal_at_end?) (regopt)) $_)}