Skip to content

Instantly share code, notes, and snippets.

@dentarg
Created May 22, 2012 14:41
Show Gist options
  • Select an option

  • Save dentarg/2769487 to your computer and use it in GitHub Desktop.

Select an option

Save dentarg/2769487 to your computer and use it in GitHub Desktop.
Which line break method do you prefer?
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
@dentarg
Copy link
Author

dentarg commented May 22, 2012

Pretend lines are longer than they are and must be wrapped to not exceed 72/78/80 characters.

@jage
Copy link

jage commented May 22, 2012

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