Heads up: This description was created by AI and might not be 100% accurate.

plain_text.rb

This Ruby code snippet demonstrates a heredoc string literal. It assigns the string “string\n” to the variable doc. Heredocs allow multi-line strings to be defined without needing to escape newlines, making them useful for embedding larger blocks of text. The <<~ operator strips leading whitespace from each line within the heredoc.

Ruby code snippet

doc = <<~'EOL'
  string
EOL
#=> "string\n"

Executed with Ruby 3.4.5.