From fed6497f9aa652423a3480ac262aed6288517958 Mon Sep 17 00:00:00 2001 From: Thomas Breier Date: Tue, 19 May 2015 16:32:02 -0700 Subject: [PATCH] Favor trailing dot for multi-line chaining of methods --- README.md | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index e59a3898c..402687220 100644 --- a/README.md +++ b/README.md @@ -445,28 +445,11 @@ Translations of the guide are available in the following languages: ``` * - Adopt a consistent multi-line method chaining style. There are two - popular styles in the Ruby community, both of which are considered - good - leading `.` (Option A) and trailing `.` (Option B). + When continuing a chained method invocation on another line, + include the `.` on the first line to indicate that the expression + continues. [[link](#consistent-multi-line-chains)] - * **(Option A)** When continuing a chained method invocation on - another line keep the `.` on the second line. - - ```Ruby - # bad - need to consult first line to understand second line - one.two.three. - four - - # good - it's immediately clear what's going on the second line - one.two.three - .four - ``` - - * **(Option B)** When continuing a chained method invocation on another line, - include the `.` on the first line to indicate that the - expression continues. - ```Ruby # bad - need to read ahead to the second line to know that the chain continues one.two.three @@ -477,9 +460,6 @@ Translations of the guide are available in the following languages: four ``` - A discussion on the merits of both alternative styles can be found - [here](https://github.com/bbatsov/ruby-style-guide/pull/176). - * Align the parameters of a method call if they span more than one line. When aligning parameters is not appropriate due to line-length