るりまサーチ

最速Rubyリファレンスマニュアル検索!
7件ヒット [1-7件を表示] (0.049秒)
トップページ > クエリ:Hash.new[x] > クエリ:context=[x] > クラス:ERB[x]

別のキーワード

  1. argf.class lines
  2. argf.class each
  3. argf.class each_line
  4. argf.class gets
  5. argf.class to_a

ライブラリ

検索結果

ERB#result(b=TOPLEVEL_BINDING) -> String (13.0)

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

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

@param b eRubyスクリプトが実行されるときのbinding

//emlist[例][ruby]{
require 'erb'
erb
= ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
test1 = "foo"
test2 = "bar"
puts erb.result
# test foo
# test bar
//...
...}

@see ERB#result_with_hash...