Skip to content

Commit 4e98267

Browse files
author
Bozhidar Batsov
committed
fixes #80 - Indentation on multi-line method calls
1 parent 232e98d commit 4e98267

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,41 @@ 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.
161+
162+
```Ruby
163+
# starting point (line is too long)
164+
def send_mail(source)
165+
Mailer.deliver(to: 'bob@example.com', from: 'us@example.com', subject: 'Important message', body: source.text)
166+
end
167+
168+
# bad (normal indent)
169+
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)
175+
end
176+
177+
# bad (double indent)
178+
def send_mail(source)
179+
Mailer.deliver(
180+
to: 'bob@example.com',
181+
from: 'us@example.com',
182+
subject: 'Important message',
183+
body: source.text)
184+
end
185+
186+
# good
187+
def send_mail(source)
188+
Mailer.deliver(to: 'bob@example.com',
189+
from: 'us@example.com',
190+
subject: 'Important message',
191+
body: source.text)
192+
end
193+
```
194+
160195
* Use RDoc and its conventions for API documentation. Don't put an
161196
empty line between the comment block and the `def`.
162197
* Keep lines fewer than 80 characters.

0 commit comments

Comments
 (0)