るりまサーチ

最速Rubyリファレンスマニュアル検索!
371件ヒット [1-100件を表示] (0.031秒)

別のキーワード

  1. erb run
  2. erb new
  3. erb src
  4. erb result
  5. erb version

検索結果

<< 1 2 3 ... > >>

ERB#set_eoutvar(compiler, eoutvar = &#39;_erbout&#39;) -> Array (27428.0)

ERBの中でeRubyスクリプトの出力をためていく変数を設定します。

...
ERB
の中でeRubyスクリプトの出力をためていく変数を設定します。

ERB
でeRubyスクリプトの出力をためていく変数を設定するために使用します。
この設定は ERB#new でも行えるため、通常はそちらを使用した方がより容易です。...
...本メソッドを使用するためには、引数にて指定する eRuby コンパイラを事前に生成しておく必要があります。

@param compiler eRubyコンパイラ

@param eoutvar eRubyスクリプトの中で出力をためていく変数...

ERB#def_module(methodname=&#39;erb&#39;) -> Module (27331.0)

変換した Ruby スクリプトをメソッドとして定義した無名のモジュールを返します。

...Ruby スクリプトをメソッドとして定義した無名のモジュールを返します。

@param methodname メソッド名

//emlist[例][ruby]{
require 'erb'
filename = 'example.rhtml'
erb
= ERB.new("test1<%= arg1 %>\ntest2<%= arg2 %>\n")
erb
.filename = filename
MyModule = erb.def_modul...
...e('render(arg1, arg2)')
class MyClass
include MyModule
end
print MyClass.new.render('foo', 123)
# test1foo
# test2123
//}...

ERB#result(b=TOPLEVEL_BINDING) -> String (27146.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...

ERB#run(b=TOPLEVEL_BINDING) -> nil (27140.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#result_with_hash(hash) -> String (27122.0)

ERB をハッシュオブジェクトで指定されたローカル変数を持つ 新しいトップレベルバインディングで実行し、結果の文字列を返します。

...
ERB
をハッシュオブジェクトで指定されたローカル変数を持つ
新しいトップレベルバインディングで実行し、結果の文字列を返します。

@param hash ローカル変数名をキーにしたハッシュ

@see ERB#result...

絞り込み条件を変える

ERB.new(str, safe_level=NOT_GIVEN, trim_mode=NOT_GIVEN, eoutvar=NOT_GIVEN, trim_mode: nil, eoutvar: &#39;_erbout&#39;) -> ERB (21541.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_mode, eoutvar の指定は非推奨です。
Ruby 3.2 で削除されました。
trim_mode と eoutv...
...ruby]{
require "erb"

# build data class
class Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc => "A well messages pattie, breaded and fried.",
:cost => 9.95 }

attr_reader :product, :price

def initialize( product = "", price = "" )
@product = produc...

ERB.new(str, safe_level=nil, trim_mode=nil, eoutvar=&#39;_erbout&#39;) -> ERB (21441.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_mode, eoutvar の指定は非推奨です。
Ruby 3.2 で削除されました。
trim_mode と eoutv...
...ruby]{
require "erb"

# build data class
class Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc => "A well messages pattie, breaded and fried.",
:cost => 9.95 }

attr_reader :product, :price

def initialize( product = "", price = "" )
@product = produc...

ERB.new(str, trim_mode: nil, eoutvar: &#39;_erbout&#39;) -> ERB (21441.0)

eRubyスクリプト から ERB オブジェクトを生成して返します。

...eRubyスクリプト から ERB オブジェクトを生成して返します。

@param str eRubyスクリプトを表す文字列
@param trim_mode 整形の挙動を変更するオプション

@param eoutvar eRubyスクリプトの中で出力をためていく変数の名前を表す文...
...字列。eRuby スクリプトの中でさらに ERB を使うときに変更
します。通常は指定する必要はありません。


//emlist[例][ruby]{
require "erb"

# build data class
class Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc =...
...uct, :price

def initialize( product = "", price = "" )
@product = product
@price = price
end

def build
b = binding
# create and run templates, filling member data variables
ERB
.new(<<~'END_PRODUCT', eoutvar: "@product").result b
<%= PRODUCT[:name] %>
<%= PRODU...

ERB#def_class(superklass=Object, methodname=&#39;erb&#39;) -> Class (21231.0)

変換した Ruby スクリプトをメソッドとして定義した無名のクラスを返します。

...変換した Ruby スクリプトをメソッドとして定義した無名のクラスを返します。


@param superklass 無名クラスのスーパークラス

@param methodname メソッド名

//emlist[例][ruby]{
require 'erb'

class MyClass_
def initialize(arg1, arg2)
@arg1 = arg1...
...; @arg2 = arg2
end
end
filename = 'example.rhtml' # @arg1 と @arg2 が使われている example.rhtml

erb
= ERB.new(File.read(filename))
erb
.filename = filename
MyClass = erb.def_class(MyClass_, 'render()')
print MyClass.new('foo', 123).render()

# => test1foo
# test2123
//}...

ERB::Util.#u(s) -> String (21113.0)

文字列 s を URLエンコードした文字列を返します。

... URLエンコードした文字列を返します。

文字列 s 中に含まれる 2バイト文字や半角スペースについて URL エンコードを行った文字列を返します(CGI.escapeとほぼ同じです)。

@param s URLエンコードを行う文字列

//emlist[例][ruby]{
requ...
...ire "erb"
include ERB::Util

puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
# Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
//}...

絞り込み条件を変える

Gem::ConfigFile::DEFAULT_VERBOSITY -> true (12200.0)

ログレベルのデフォルト値です。

ログレベルのデフォルト値です。

Net::SMTPServerBusy (12000.0)

SMTP 一時エラーに対応する例外クラスです。 SMTP エラーコード 420, 450 に対応します。

SMTP 一時エラーに対応する例外クラスです。
SMTP エラーコード 420, 450 に対応します。
<< 1 2 3 ... > >>