Ruby 2.4.0 リファレンスマニュアル > ライブラリ一覧 > erbライブラリ > ERBクラス > run
run(b=TOPLEVEL_BINDING) -> nil
[permalink][rdoc]ERB を b の binding で実行し、結果を標準出力へ印字します。
require 'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
test1 = "foo"
test2 = "bar"
erb.run
# test foo
# test bar