lib/rubocop/cop/performance/squeeze.rb in rubocop-performance-1.8.1 vs lib/rubocop/cop/performance/squeeze.rb in rubocop-performance-1.9.0
- old
+ new
@@ -20,10 +20,11 @@
#
class Squeeze < Base
extend AutoCorrector
MSG = 'Use `%<prefer>s` instead of `%<current>s`.'
+ RESTRICT_ON_SEND = %i[gsub gsub!].freeze
PREFERRED_METHODS = {
gsub: :squeeze,
gsub!: :squeeze!
}.freeze
@@ -56,10 +57,10 @@
end
private
def repeating_literal?(regex_str)
- regex_str.match?(/\A(?:#{Util::LITERAL_REGEX})\+\z/)
+ regex_str.match?(/\A(?:#{Util::LITERAL_REGEX})\+\z/o)
end
end
end
end
end