Created
May 22, 2012 14:41
-
-
Save dentarg/2769487 to your computer and use it in GitHub Desktop.
Which line break method do you prefer?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def method1 | |
| if @something.save | |
| flash[:success] = "Woho! Great success to add | |
| add #{@something} to the | |
| list of things." | |
| end | |
| end | |
| def method2 | |
| if @something.save | |
| flash[:success] = "Woho! Great success to | |
| add #{@something} to the | |
| list of things." | |
| end | |
| end | |
| def method3 | |
| if @something.save | |
| flash[:success] = "Woho! Great success to | |
| add #{@something} to the | |
| list of things." | |
| end | |
| end |
Author
Note that the resulting string will differ. But I prefer method1 or method2 depending on how far to the right the string starts.
Alternative:
flash[:success] = "Line one" <<
"Line two" <<
"Line three"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pretend lines are longer than they are and must be wrapped to not exceed 72/78/80 characters.