Class: Rubocop::Cop::InBatches

Inherits:
RuboCop::Cop::Base
  • Object
show all
Defined in:
lib/rubocop/cop/in_batches.rb

Overview

Cop that prevents the use of ‘in_batches`

Examples:

# bad
Foo.in_batches do |relation|
end

# good
Foo.each_batch do |relation|
end

Constant Summary collapse

MSG =
'Do not use `in_batches`, use `each_batch` from the EachBatch module instead'
RESTRICT_ON_SEND =
%i[in_batches].freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



19
20
21
# File 'lib/rubocop/cop/in_batches.rb', line 19

def on_send(node)
  add_offense(node.loc.selector)
end