lib/rubocop/cop/rails/negate_include.rb in rubocop-rails-2.17.4 vs lib/rubocop/cop/rails/negate_include.rb in rubocop-rails-2.18.0
- old
+ new
@@ -24,10 +24,10 @@
MSG = 'Use `.exclude?` and remove the negation part.'
RESTRICT_ON_SEND = %i[!].freeze
def_node_matcher :negate_include_call?, <<~PATTERN
- (send (send $_ :include? $_) :!)
+ (send (send $!nil? :include? $_) :!)
PATTERN
def on_send(node)
return unless (receiver, obj = negate_include_call?(node))