Method chains that are written on a single line can become difficult to read and understand, particularly when the chain is long. This can lead to errors or bugs that are hard to spot and fix.
By placing each method call on a separate line, the code becomes easier to read and maintain, improving overall code quality and reducing the risk of errors.
items.select { |item| item.cond? }.join('-').each { |item| puts item }
items.select { |item| item.cond? }
.join('-')
.each { |item| puts item }