Skip to content

Commit

Permalink
Add section about long &. chains
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima committed Sep 11, 2024
1 parent e66a93a commit 4f178e0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,20 @@ class User
end
user&.zip
----

=== Long safe navigation chain [[long-safe-navigation-chain]]

Avoid `&.` chains longer than two.

[source,ruby]
----
# bad
user&.address&.zip
# good
user.address.zip if user
----

=== Spaces and Braces [[spaces-braces]]

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

0 comments on commit 4f178e0

Please sign in to comment.