Read_file.rb

This content was produced by an LLM and could include errors.

This script uses the ERB library to process an HTML template file. It injects the variable @val into the template, generating the final rendered HTML string dynamically.

require 'erb'
#=> true

erb = ERB.new(File.read('input/erb/file.html.erb'))
#=> #<ERB:0x00007fb82c25f968
#...
@val = 'val'
#=> "val"

erb.result(binding)
#=> "<h1>header</h1>\n\n<p>val</p>\n"

Ruby 4.0.3