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

with_value.rb

This Ruby code snippet demonstrates string interpolation and a heredoc. It assigns the string “ruby” to the variable value. Then, it uses a heredoc (<<~EOL) to define a multi-line string. Within the heredoc, #{value} interpolates the value of the value variable, resulting in a string containing “ruby” followed by a newline character.

Ruby code snippet

value = 'ruby'
#=> "ruby"
doc = <<~EOL
  #{value}
EOL
#=> "ruby\n"

Executed with Ruby 3.4.5.