Skip to content

Commit 1c17c18

Browse files
committed
Add section about long &. chains
1 parent e66a93a commit 1c17c18

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.adoc

+14
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,20 @@ class User
351351
end
352352
user&.zip
353353
----
354+
355+
=== Too long safe navigation chain [[too-long-safe-navigation-chain]]
356+
357+
Avoid `&.` chains longer than two.
358+
359+
[source,ruby]
360+
----
361+
# bad
362+
user&.address&.zip
363+
364+
# good
365+
user.address.zip if user
366+
----
367+
354368
=== Spaces and Braces [[spaces-braces]]
355369

356370
No spaces after `(`, `[` or before `]`, `)`.

0 commit comments

Comments
 (0)