Skip to content

Commit

Permalink
Fix code in Spaces and Braces
Browse files Browse the repository at this point in the history
  • Loading branch information
ydakuka committed Nov 3, 2023
1 parent ce258a1 commit 565c0c2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,17 @@ E.g. if users are guaranteed to have an address and addresses are guaranteed to
# bad
user&.address&.zip
#good
# good
user && user.address.zip
----

If such a change introduces excessive conditional logic, consider other approaches, such as delegation:
[source, ruby]
----
#bad
# bad
user && user.address && user.address.zip
#good
# good
class User
def zip
address&.zip
Expand Down Expand Up @@ -376,11 +376,11 @@ Whichever one you pick - apply it consistently.

[source,ruby]
----
# bad - no space after { and before }
{one: 1, two: 2}
# good - space after { and before }
{ one: 1, two: 2 }
# good - no space after { and before }
{one: 1, two: 2}
----

With interpolated expressions, there should be no padded-spacing inside the braces.
Expand Down

0 comments on commit 565c0c2

Please sign in to comment.