How do you have a multiline string with no leading spaces and still be properly aligned with method? Here are some of my attempts. The one that is working is not very fun...
module Something
def welcome
"
Hello
This is an example. I have to write this multiline string outside the welcome method
indentation in order for it to be properly formatted on screen. :(
"
end
end
module Something
def welcome
"
Hello
This is an example. I am inside welcome method indentation but for some reason
I am not working...
".ljust(12)
end
end
module Something
def welcome
"Hello\n\n"+
"This is an example. I am inside welcome method indentation and properly"+
"formatted but isn't there a better way?"
end
end
UPDATE
Here's a method from the ruby style guide:
code = <<-END.gsub(/^\s+\|/, '')
|def test
| some_method
| other_method
|end
END
# => "def test\n some_method\n other_method\nend\n"