Skip to content

CAT 024

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-024 — keys/values.map → each_key/each_value

Field Value
Severity info
Confidence high
Auto-fix

keys/values.map → each_key/each_value — Use each_key/each_value with a block instead of .keys.map/.values.map to avoid intermediate arrays.

Bad code

hash.keys.map { |k| k.to_s }
hash.values.map { |v| v * 2 }

Clone this wiki locally