式展開なしの Heredoc
2020年10月14日
Ruby の Heredoc を式展開('#{....}')なしで使いたいことがあります。キーワードの前後にシングルダッシュを追加することで実現できます:
doc = <<-'SONG'
Business men, they drink my wine
#{person} dig my earth
None will level on the line
Nobody offered his word
Hey, hey
SONG
Ruby の Heredoc を式展開('#{....}')なしで使いたいことがあります。キーワードの前後にシングルダッシュを追加することで実現できます:
doc = <<-'SONG'
Business men, they drink my wine
#{person} dig my earth
None will level on the line
Nobody offered his word
Hey, hey
SONG