Module: RuboCop::Cop::CheckAssignment

Overview

Common functionality for checking assignment nodes.

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 14

def on_send(node)
  # we only want to indent relative to the receiver
  # when the method called looks like a setter
  return unless node.asgn_method_call?

  # This will match if, case, begin, blocks, etc.
  rhs = extract_rhs(node)
  check_assignment(node, rhs) if rhs.is_a?(AST::Node)
end