Trying to format a mutliline string in Ruby
heredoc and %q{ } have the issue that they include whitespace used for formatting the code.
s = %q{Foo Bar Baz} puts s Incorrectly outputs the following:
Foo Bar Baz The following works, but is a bit ugly with the \ characters.
s = "Foo\n" \ " Bar\n" \ " Baz" puts s The following works in python:
s = ("Foo\n" " Bar\n" " Baz") print s Is there an equivalent in Ruby?
textwrap.dedentas the equivalent Python example, because the Ruby snippet is hardly more complicated than your Python snippet. You should also make it clear that your not interested in non-builtin methods.