<<~を使うとstrip_heredoc と同様に、ヒアドキュメント内のインデ ントを取り除いてくれる # <<- を使うと、ヒアドキュメント内のインデントがそのままスペースとして残ってしまう text_with_legacy_heredoc = <<-TEXT This would contain specially formatted text. That might span many lines TEXT " This would contain specially formatted text.¥n That might span many lines¥n“ Ruby 2.3
<<-TEXT.strip_heredoc This would contain specially formatted text. That might span many lines TEXT "This would contain specially formatted text.¥nThat might span many lines¥n“ # <<~ を使うとstrip_heredocと同じようにインデントのスペースを取り除いてくれる text_with_squiggly_heredoc = <<~TEXT This would contain specially formatted text. That might span many lines TEXT => "This would contain specially formatted text.¥nThat might span many lines¥n" Ruby 2.3