class RuboCop::Cop::Style::DoubleNegation
this is rarely a problem in practice.
As you’re unlikely to write code that can accept values of any type
!!something and !something.nil? are not the same thing.
Please, note that when something is a boolean value
!something.nil?
# good
!!something
# bad
@example
should be avoided.
to a boolean value. As this is both cryptic and usually redundant, it
This cop checks for uses of double negation (!!) to convert something
def on_send(node)
def on_send(node) return unless double_negative?(node) && node.prefix_bang? add_offense(node, location: :selector) end