Class: RuboCop::Cop::Rails::IndexBy
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::IndexBy
- Extended by:
- AutoCorrector
- Includes:
- IndexMethod
- Defined in:
- lib/rubocop/cop/rails/index_by.rb
Overview
Looks for uses of each_with_object({}) { ... },
map { ... }.to_h, and Hash[map { ... }] that are transforming
an enumerable into a hash where the values are the original elements.
Rails provides the index_by method for this purpose.