class Rubocop::Cop::Style::Proc

This cops checks for uses of Proc.new where Kernel#proc would be more appropriate.

Constants

MSG
TARGET

Public Instance Methods

on_block(node) click to toggle source
Calls superclass method
# File lib/rubocop/cop/style/proc.rb, line 13
def on_block(node)
  # We're looking for
  # (block
  #   (send
  #     (const nil :Proc) :new)
  #   ...)
  block_method, = *node

  if block_method == TARGET
    add_offence(:convention, block_method.loc.expression, MSG)
  end

  super
end