class Rubocop::Cop::Style::OpMethod

This cop makes sure that certain operator methods have their sole parameter named other.

Constants

BLACKLISTED
MSG
TARGET_ARGS

Public Instance Methods

on_def(node) click to toggle source
Calls superclass method
# File lib/rubocop/cop/style/op_method.rb, line 15
def on_def(node)
  name, args, _body = *node

  if name !~ /\A\w/ && !BLACKLISTED.include?(name) &&
      args.children.size == 1 && args != TARGET_ARGS
    add_offence(:convention, args.children[0].loc.expression,
                sprintf(MSG, name))
  end

  super
end