instance method ERB#result

result(b=TOPLEVEL_BINDING) -> String[permalink][rdoc][edit]

ERB を b の binding で実行し、結果の文字列を返します。

[PARAM] b:
eRubyスクリプトが実行されるときの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