File tree 1 file changed +25
-9
lines changed
1 file changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -403,17 +403,33 @@ Translations of the guide are available in the following languages:
403
403
' and second part of the long string'
404
404
```
405
405
406
- * When continuing a chained method invocation on another line keep the ` .` on the second line.
406
+ * Adopt a consistent multi- line method chaining style. There are two
407
+ popular styles in the Ruby community, both of which are considered
408
+ good - leading ` .` and trailing ` .` .
407
409
408
- ` ` ` Ruby
409
- # bad - need to consult first line to understand second line
410
- one.two.three.
411
- four
410
+ * When continuing a chained method invocation on another line keep the ` .` on the second line.
412
411
413
- # good - it's immediately clear what's going on the second line
414
- one.two.three
415
- .four
416
- ` ` `
412
+ ` ` ` Ruby
413
+ # bad - need to consult first line to understand second line
414
+ one.two.three.
415
+ four
416
+
417
+ # good - it's immediately clear what's going on the second line
418
+ one.two.three
419
+ .four
420
+ ` ` `
421
+
422
+ * When continuing a chained method invocation on another line, include the ` .` on the first line to indicate that the expression continues.
423
+
424
+ ` ` ` Ruby
425
+ # bad - need to read ahead to the second line to know that the chain continues
426
+ one.two.three
427
+ .four
428
+
429
+ # good - it's immediately clear that the expression continues beyond the first line
430
+ one.two.three.
431
+ four
432
+ ` ` `
417
433
418
434
* Align the parameters of a method call if they span more than one
419
435
line. When aligning parameters is not appropriate due to line- length
You can’t perform that action at this time.
0 commit comments