Skip to content

Files

Latest commit

 

History

History
27 lines (18 loc) · 601 Bytes

Layout-SingleLineBlockChain.md

File metadata and controls

27 lines (18 loc) · 601 Bytes

Pattern: Single-line block chain

Issue: -

Description

Checks if method calls are chained onto single line blocks. It considers that a line break before the dot improves the readability of the code.

Examples

# bad
example.select { |item| item.cond? }.join('-')

# good
example.select { |item| item.cond? }
       .join('-')

# good (not a concern for this cop)
example.select do |item|
  item.cond?
end.join('-')

Further Reading