Ruby 2.6.0 リファレンスマニュアル > ライブラリ一覧 > erbライブラリ > ERBクラス > result
result(b=TOPLEVEL_BINDING) -> String
[permalink][rdoc]ERB を b の binding で実行し、結果の文字列を返します。
require 'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
test1 = "foo"
test2 = "bar"
puts erb.result
# test foo
# test bar
[SEE_ALSO] ERB#result_with_hash