Skip to content

Commit fd77f39

Browse files
author
Ethan
committed
Merge pull request #3 from mdsol/multiline_method_param_indent
change the "good" method parameter indentation to two spaces
2 parents ae14df0 + 162142e commit fd77f39

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,21 @@ You can generate a PDF or an HTML copy of this guide using
157157
end
158158
```
159159

160-
* Align the parameters of a method call if they span over multiple lines.
160+
* Indent the parameters of a method call with two spaces if they span over multiple lines.
161+
Optionally place the trailing `)` on its own line returning to the parent indentation.
161162

162163
```Ruby
163164
# starting point (line is too long)
164165
def send_mail(source)
165166
Mailer.deliver(to: 'bob@example.com', from: 'us@example.com', subject: 'Important message', body: source.text)
166167
end
167168
168-
# bad (normal indent)
169+
# bad (large indent aligning with the method's open-parenthesis)
169170
def send_mail(source)
170-
Mailer.deliver(
171-
to: 'bob@example.com',
172-
from: 'us@example.com',
173-
subject: 'Important message',
174-
body: source.text)
171+
Mailer.deliver(to: 'bob@example.com',
172+
from: 'us@example.com',
173+
subject: 'Important message',
174+
body: source.text)
175175
end
176176
177177
# bad (double indent)
@@ -183,12 +183,23 @@ You can generate a PDF or an HTML copy of this guide using
183183
body: source.text)
184184
end
185185
186-
# good
186+
# good (two space indent)
187187
def send_mail(source)
188-
Mailer.deliver(to: 'bob@example.com',
189-
from: 'us@example.com',
190-
subject: 'Important message',
191-
body: source.text)
188+
Mailer.deliver(
189+
to: 'bob@example.com',
190+
from: 'us@example.com',
191+
subject: 'Important message',
192+
body: source.text)
193+
end
194+
195+
# good (two space indent with close parenthesis returning to parent indent)
196+
def send_mail(source)
197+
Mailer.deliver(
198+
to: 'bob@example.com',
199+
from: 'us@example.com',
200+
subject: 'Important message',
201+
body: source.text
202+
)
192203
end
193204
```
194205

0 commit comments

Comments
 (0)