Class: RuboCop::Cop::Rails::IndexWith
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Rails::IndexWith
- Extended by:
- TargetRailsVersion
- Includes:
- IndexMethod
- Defined in:
- lib/rubocop/cop/rails/index_with.rb
Overview
This cop looks for uses of ‘each_with_object({}) { … }`, `map { … }.to_h`, and `Hash[map { … }]` that are transforming an enumerable into a hash where the keys are the original elements. Rails provides the `index_with` method for this purpose.
Method Summary
Methods included from TargetRailsVersion
minimum_target_rails_version, support_target_rails_version?