るりまサーチ

最速Rubyリファレンスマニュアル検索!
150件ヒット [1-100件を表示] (0.131秒)
トップページ > クエリ:i[x] > クエリ:l[x] > ライブラリ:erb[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. matrix i
  5. csv to_i

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

ERB#filename -> String (12202.0)

エラーメッセージを表示する際のファイル名を取得します。

...エラーメッセージを表示する際のファイル名を取得します。

//emlist[例][ruby]{
require 'erb'
filename = 'example.rhtml'
erb
= ERB.new(File.read(filename))
erb
.filename # => nil
erb
.filename = filename
erb
.filename # =>"example.rhtml"
//}...

ERB#filename= -> String (12202.0)

エラーメッセージを表示する際のファイル名を設定します。

...filename を設定しておくことにより、エラーが発生した eRuby スクリプトの特定が容易になります。filename を設定していない場合は、エラー発生箇所は「 (ERB) 」という出力となります。

//emlist[例][ruby]{
require 'erb'
filename = 'exampl...
...e.rhtml'
erb
= ERB.new(File.read(filename))
erb
.filename # => nil
erb
.filename = filename
erb
.filename # =>"example.rhtml"
//}...

ERB#result_with_hash(hash) -> String (12202.0)

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

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

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

@see ERB#result...

ERB::Util (12002.0)

eRubyスクリプトのためのユーティリティを提供するモジュールです。

eRubyスクリプトのためのユーティリティを提供するモジュールです。

ERB::Util.#html_escape(s) -> String (9202.0)

文字列 s を HTML用にエスケープした文字列を返します。

...を HTML用にエスケープした文字列を返します。

文字列 s 中に含まれる &"<> を、実体参照 &amp; &quot; &lt; &gt; にそれぞれ変更した文字列を返します
(CGI.escapeHTMLとほぼ同じです)。

@param s HTMLエスケープを行う文字列

//emlist[例][...
...ruby]{
require "erb"
i
nclude ERB::Util

puts html_escape("is a > 0 & a < 10?")
# is a &gt; 0 &amp; a &lt; 10?
//}...

絞り込み条件を変える

ERB::Util.#url_encode(s) -> String (9202.0)

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

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

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

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

//emlist[例][ruby]{
requir...
...e "erb"
i
nclude ERB::Util

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

ERB#result(b=TOPLEVEL_BINDING) -> String (6402.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::Util.#h(s) -> String (6102.0)

文字列 s を HTML用にエスケープした文字列を返します。

...を HTML用にエスケープした文字列を返します。

文字列 s 中に含まれる &"<> を、実体参照 &amp; &quot; &lt; &gt; にそれぞれ変更した文字列を返します
(CGI.escapeHTMLとほぼ同じです)。

@param s HTMLエスケープを行う文字列

//emlist[例][...
...ruby]{
require "erb"
i
nclude ERB::Util

puts html_escape("is a > 0 & a < 10?")
# is a &gt; 0 &amp; a &lt; 10?
//}...

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

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

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

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

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

//emlist[例][ruby]{
requir...
...e "erb"
i
nclude ERB::Util

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

ERB.new(str, safe_level=NOT_GIVEN, trim_mode=NOT_GIVEN, eoutvar=NOT_GIVEN, trim_mode: nil, eoutvar: &#39;_erbout&#39;) -> ERB (402.0)

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

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

@param str eRubyスクリプトを表す文字列
@param safe_level eRubyスクリプトが実行されるときのセーフレベル
@param trim_mode 整形の挙動を変更するオプション

@param eoutvar eRuby...
...リプトの中でさらに ERB を使うときに変更
します。通常は指定する必要はありません。

Ruby 2.6.0 から位置引数での safe_level, trim_mode, eoutvar の指定は非推奨です。
Ruby 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.",
:cost => 9.95 }

attr_reader :product, :price

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

絞り込み条件を変える

ERB#run(b=TOPLEVEL_BINDING) -> nil (302.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
//}...
<< 1 2 > >>