Pattern: Inconsistent iterator use
Issue: -
This rule looks for uses of the for
keyword, or each
method. The
preferred alternative is set in the EnforcedStyle configuration
parameter. An each
call with a block on a single line is always
allowed, however.
# bad
for elem in arr do
puts elem
end
# good
arr.each { |elem| puts elem }
Attribute | Value |
---|---|
EnforcedStyle | each |
SupportedStyles | for, each |