Method: RuboCop::Cop::Style::Blocks#on_send

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

#on_send(node) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rubocop/cop/style/blocks.rb', line 14

def on_send(node)
  _receiver, method_name, *args = *node
  return unless args.any?

  block = get_block(args.last)
  return unless block && !parentheses?(node) && !operator?(method_name)

  # If there are no parentheses around the arguments, then braces and
  # do-end have different meaning due to how they bind, so we allow
  # either.
  ignore_node(block)
end