Parent

Methods

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::DoubleNegation

This cop checks for uses of double negation (!!) to convert something to a boolean value. As this is both cryptic and usually redundant it should be avoided.

@example

# bad
!!something

# good
!something.nil?

Constants

MSG

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/style/double_negation.rb, line 19
def on_send(node)
  return unless not_node?(node)

  receiver, _method_name, *_args = *node

  add_offense(node, :selector) if not_node?(receiver)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.