Heredoc แบบไม่มี interpolation
14 ตุลาคม 2563
บางครั้งคุณอาจอยากใช้ Heredoc ของ Ruby แบบไม่มี interpolation ('#{....}') ซึ่งทำได้โดยใส่ dash เดี่ยวรอบ keyword ของคุณ:
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