Heads up: This description was created by AI and might not be 100% accurate.
plain_text.rb
This Ruby code snippet demonstrates how to use a here document to assign a string value to a variable named doc
. The here document is denoted by the <<
and EOL
markers, which indicate that the text between them should be treated as a single string.
Here is an example of how this code might be used:
doc = <<~'EOL'
This is a string with multiple lines.
It can contain anything you want, including special characters like $ or @.
EOL
puts doc
This code would output the following string to the console:
This is a string with multiple lines.
It can contain anything you want, including special characters like $ or @.
Ruby code snippet
doc = <<~'EOL'
string
EOL
#=> "string\n"
Executed with Ruby 3.4.4
.