Skip to content

Commit e4037f2

Browse files
authored
Merge pull request #2 from ActionSprout/choose-dot-continuation-style
Prefer trailing dots over leading dots
2 parents 5d2dcdb + a13f1e9 commit e4037f2

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

ruby.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -521,28 +521,11 @@ style guide.
521521
```
522522

523523
* <a name="consistent-multi-line-chains"></a>
524-
Adopt a consistent multi-line method chaining style. There are two popular
525-
styles in the Ruby community, both of which are considered
526-
good&mdash;leading `.` (Option A) and trailing `.` (Option B).
524+
When continuing a chained method invocation on another line,
525+
include the `.` on the first line to indicate that the
526+
expression continues.
527527
<sup>[[link](#consistent-multi-line-chains)]</sup>
528528

529-
* **(Option A)** When continuing a chained method invocation on
530-
another line keep the `.` on the second line.
531-
532-
```ruby
533-
# bad - need to consult first line to understand second line
534-
one.two.three.
535-
four
536-
537-
# good - it's immediately clear what's going on the second line
538-
one.two.three
539-
.four
540-
```
541-
542-
* **(Option B)** When continuing a chained method invocation on another line,
543-
include the `.` on the first line to indicate that the
544-
expression continues.
545-
546529
```ruby
547530
# bad - need to read ahead to the second line to know that the chain continues
548531
one.two.three
@@ -553,7 +536,7 @@ style guide.
553536
four
554537
```
555538

556-
A discussion on the merits of both alternative styles can be found
539+
A discussion on the merits of alternative styles can be found
557540
[here](https://github.com/bbatsov/ruby-style-guide/pull/176).
558541

559542
* <a name="no-double-indent"></a>

0 commit comments

Comments
 (0)