lib/rubocop/cop/rails/index_by.rb in rubocop-rails-2.8.1 vs lib/rubocop/cop/rails/index_by.rb in rubocop-rails-2.9.0
- old
+ new
@@ -15,11 +15,12 @@
# [1, 2, 3].map { |el| [foo(el), el] }.to_h
# Hash[[1, 2, 3].collect { |el| [foo(el), el] }]
#
# # good
# [1, 2, 3].index_by { |el| foo(el) }
- class IndexBy < Cop
+ class IndexBy < Base
include IndexMethod
+ extend AutoCorrector
def_node_matcher :on_bad_each_with_object, <<~PATTERN
(block
({send csend} _ :each_with_object (hash))
(args (arg $_el) (arg _memo))