Skip to content

CAT 006

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-006 — hash.keys.each → each_key

Field Value
Severity info
Confidence high
Auto-fix

hash.keys.each → each_key — Use each_key instead of .keys.each to avoid allocating an intermediate array of keys.

Bad code

hash.keys.each { |k| ... }

Good code

hash.each_key { |k| ... }

Clone this wiki locally