HEREDOC - http://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html#here_doc - :
def welcome
<<-"welcome".strip_heredoc
"
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. :(
"
welcome
end
strip_heredoc - http://apidock.com/rails/String/strip_heredoc.
:
strip_heredoc , Ruby on Rails ( Rails). Ruby, , strip_heredoc .: - (
Ruby! strip_heredoc Rails Ruby, String. , .: -)
:
class String
def strip_it_real_good
indent = scan(/^[ \t]*(?=\S)/).min.try(:size) || 0
gsub(/^[ \t]{#{indent}}/, '')
end
end
def welcome
<<-"welcome".strip_it_real_good
"
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. :(
"
welcome
end