3件ヒット
[1-3件を表示]
(0.017秒)
検索結果
先頭3件
-
ERB
# result(b=TOPLEVEL _ BINDING) -> String (376.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
//... -
ERB
# run(b=TOPLEVEL _ BINDING) -> nil (376.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"
erb.run
# test foo
# test bar
//}... -
ERB
. new(str , safe _ level=nil , trim _ mode=nil , eoutvar=& # 39; _ erbout& # 39;) -> ERB (25.0) -
eRubyスクリプト から ERB オブジェクトを生成して返します。
...eRubyスクリプト から ERB オブジェクトを生成して返します。
@param str eRubyスクリプトを表す文字列
@param safe_level eRubyスクリプトが実行されるときのセーフレベル
@param trim_mode 整形の挙動を変更するオプション
@param eoutvar eRuby......スクリプトの中で出力をためていく変数の名前を表す文
字列。eRuby スクリプトの中でさらに ERB を使うときに変更
します。通常は指定する必要はありません。
Ruby 2.6.0 から位置引数での safe_level, trim_m......3.2 で削除されました。
trim_mode と eoutvar の指定はキーワード引数に移行してください。
//emlist[例][ruby]{
require "erb"
# build data class
class Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc => "A well messages pattie, breaded and fried...