Class: RuboCop::Cop::Rails::IndexWith
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::IndexWith
- Extended by:
- AutoCorrector, TargetRailsVersion
- Includes:
- IndexMethod
- Defined in:
- lib/rubocop/cop/rails/index_with.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 keys are the original elements. Rails provides the `index_with` method for this purpose.
Constant Summary
Constants included from TargetRailsVersion
TargetRailsVersion::TARGET_GEM_NAME, TargetRailsVersion::USES_REQUIRES_GEM_API
Constants included from IndexMethod
Method Summary
Methods included from TargetRailsVersion
minimum_target_rails_version, support_target_rails_version?