Method: RuboCop::Cop::Style::InverseMethods#on_send

Defined in:
lib/rubocop/cop/style/inverse_methods.rb

#on_send(node) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/rubocop/cop/style/inverse_methods.rb', line 56

def on_send(node)
  return if part_of_ignored_node?(node)
  inverse_candidate?(node) do |_method_call, lhs, method, rhs|
    return unless inverse_methods.key?(method)
    return if possible_class_hierarchy_check?(lhs, rhs, method)
    return if negated?(node)

    add_offense(node,
                message: format(MSG, method: method,
                                     inverse: inverse_methods[method]))
  end
end