class RuboCop::Cop::Performance::MethodObjectAsBlock


[1, 2, 3].each { |x| out.puts(x) }
array.map { |x| do_something(x) }
# good
[1, 2, 3].each(&out.method(:puts))
array.map(&method(:do_something))
# bad
@example
It is faster to replace those with explicit blocks, calling those methods inside.
use of ‘&method`, and passed as arguments to method calls.
Identifies places where methods are converted to blocks, with the

def on_block_pass(node)

def on_block_pass(node)
  add_offense(node) if method_object_as_argument?(node)
end