diff --git a/README.md b/README.md index 2fc3eac9f..42019c195 100644 --- a/README.md +++ b/README.md @@ -624,14 +624,6 @@ Translations of the guide are available in the following languages: body: source.text) end - # good - def send_mail(source) - Mailer.deliver(to: 'bob@example.com', - from: 'us@example.com', - subject: 'Important message', - body: source.text) - end - # good (normal indent) def send_mail(source) Mailer.deliver( @@ -643,6 +635,40 @@ Translations of the guide are available in the following languages: end ``` +* + Use a new line for the argument list of a method at the end of a chain + if they are indented more than one level from the first method. +[[link](#no-hanging-indent)] + + ```ruby + # bad (hanging indent) + some_method.with.a_longer.chain(:parameter_1, + :parameter_2, + :parameter_3, + :parameter_4) + + # good (newline indent) + some_method.with.a_longer.chain( + :parameter_1, + :parameter_2, + :parameter_3, + :parameter_4 + ) + + # good (multiple methods with newline indent) + very_long_kumquats = + some_method + .with + .a_much_much_much_much_much + .longer + .chain( + :parameter_1, + :parameter_2, + :parameter_3, + :parameter_4 + ) + ``` + * Align the elements of array literals spanning multiple lines. [[link](#align-multiline-arrays)]