Skip to content

Files

Latest commit

 

History

History
34 lines (24 loc) · 713 Bytes

Style-For.md

File metadata and controls

34 lines (24 loc) · 713 Bytes

Pattern: Inconsistent iterator use

Issue: -

Description

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.

Examples

# bad
for elem in arr do
  puts elem
end

# good
arr.each { |elem| puts elem }

Default configuration

Attribute Value
EnforcedStyle each
SupportedStyles for, each

Further Reading