11件ヒット
[1-11件を表示]
(0.021秒)
種類
- モジュール関数 (5)
- 特異メソッド (2)
- インスタンスメソッド (2)
- クラス (1)
- 文書 (1)
モジュール
-
ERB
:: DefMethod (1) -
ERB
:: Util (4)
キーワード
-
def
_ erb _ method (1) - h (1)
-
html
_ escape (1) - new (1)
- result (1)
-
ruby 1
. 8 . 3 feature (1) - src (1)
- u (1)
-
url
_ encode (1) - verbose= (1)
検索結果
先頭5件
-
ERB (114199.0)
-
eRuby スクリプトを処理するクラス。
eRuby スクリプトを処理するクラス。
従来 ERbLight と呼ばれていたもので、
標準出力への印字が文字列の挿入とならない点が eruby と異なります。
* https://magazine.rubyist.net/articles/0017/0017-BundledLibraries.html
=== 使い方
ERB クラスを使うためには require 'erb' する必要があります。
例:
require 'erb'
ERB.new($<.read).run
=== trim_mode
trim_mode は整形の挙動を変更するオプションです。次の... -
ERB
. new(str , safe _ level=NOT _ GIVEN , trim _ mode=NOT _ GIVEN , eoutvar=NOT _ GIVEN , trim _ mode: nil , eoutvar: & # 39; _ erbout& # 39;) -> ERB (63742.0) -
eRubyスクリプト から ERB オブジェクトを生成して返します。
...by スクリプトの中でさらに ERB を使うときに変更
します。通常は指定する必要はありません。
Ruby 2.6.0 から位置引数での safe_level, trim_mode, eoutvar の指定は非推奨です。
Ruby 3.2 で削除されました。
trim_mode と eoutvar... -
ERB
# result(b=TOPLEVEL _ BINDING) -> String (63157.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
# src -> String (63091.0) -
変換した Ruby スクリプトを取得します。
変換した Ruby スクリプトを取得します。
//emlist[例][ruby]{
require 'erb'
erb = ERB.new("test1<%= @arg1%>\ntest2<%= @arg2%>\n\n")
puts erb.src
# #coding:UTF-8
# _erbout = +''; _erbout.<< "test1".freeze; _erbout.<<(( @arg1).to_s); _erbout.<< "\ntest2".freeze
# ; _erbout.<<(( @arg2).to_s); _erbout.<< "\n\n".freeze
#... -
ERB
:: DefMethod . # def _ erb _ method(methodname , erb) -> nil (27835.0) -
self に erb のスクリプトをメソッドとして定義します。
self に erb のスクリプトをメソッドとして定義します。
メソッド名は methodname で指定します。
erb が文字列の時、そのファイルを読み込み ERB で変換したのち、メソッドとして定義します。
@param methodname メソッド名
@param erb ERBインスタンスもしくはERBソースファイル名
例:
require 'erb'
class Writer
extend ERB::DefMethod
def_erb_method('to_html', 'writer.erb')
...
end
...
p... -
Tracer
. verbose=(flag) (18445.0) -
トレース出力の開始や終了を知らせる文字列("Trace on"または"Trace off")が必要なら真を設定します。
トレース出力の開始や終了を知らせる文字列("Trace on"または"Trace off")が必要なら真を設定します。
@param flag トレース出力の開始や終了を知らせる文字列が必要ならtrueを設定します。
require 'tracer'
Tracer.verbose = true
Tracer.on {
puts "Hello"
}
# 出力例
Trace on
#0:t5.rb:7::-: puts "Hello"
#0:t5.rb:7:Kernel:>: puts "Hello"
#0:t5.rb:7:IO:>: ... -
ERB
:: Util . # h(s) -> String (9055.0) -
文字列 s を HTML用にエスケープした文字列を返します。
文字列 s を HTML用にエスケープした文字列を返します。
文字列 s 中に含まれる &"<> を、実体参照 & " < > にそれぞれ変更した文字列を返します
(CGI.escapeHTMLとほぼ同じです)。
@param s HTMLエスケープを行う文字列
//emlist[例][ruby]{
require "erb"
include ERB::Util
puts html_escape("is a > 0 & a < 10?")
# is a > 0 & a < 10?
//} -
ERB
:: Util . # html _ escape(s) -> String (9055.0) -
文字列 s を HTML用にエスケープした文字列を返します。
文字列 s を HTML用にエスケープした文字列を返します。
文字列 s 中に含まれる &"<> を、実体参照 & " < > にそれぞれ変更した文字列を返します
(CGI.escapeHTMLとほぼ同じです)。
@param s HTMLエスケープを行う文字列
//emlist[例][ruby]{
require "erb"
include ERB::Util
puts html_escape("is a > 0 & a < 10?")
# is a > 0 & a < 10?
//} -
ERB
:: Util . # u(s) -> String (9055.0) -
文字列 s を URLエンコードした文字列を返します。
文字列 s を URLエンコードした文字列を返します。
文字列 s 中に含まれる 2バイト文字や半角スペースについて URL エンコードを行った文字列を返します(CGI.escapeとほぼ同じです)。
@param s URLエンコードを行う文字列
//emlist[例][ruby]{
require "erb"
include ERB::Util
puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
# Programming%20Ruby%3A%20%20The%20Pragmatic%20P... -
ERB
:: Util . # url _ encode(s) -> String (9055.0) -
文字列 s を URLエンコードした文字列を返します。
文字列 s を URLエンコードした文字列を返します。
文字列 s 中に含まれる 2バイト文字や半角スペースについて URL エンコードを行った文字列を返します(CGI.escapeとほぼ同じです)。
@param s URLエンコードを行う文字列
//emlist[例][ruby]{
require "erb"
include ERB::Util
puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
# Programming%20Ruby%3A%20%20The%20Pragmatic%20P... -
ruby 1
. 8 . 3 feature (145.0) -
ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))
ruby 1.8.3 feature
*((<ruby 1.8 feature>))
*((<ruby 1.8.2 feature>))
ruby 1.8.2 から ruby 1.8.3 までの変更点です。
掲載方針
*バグ修正の影響も含めて動作が変わるものを収録する。
*単にバグを直しただけのものは収録しない。
*ライブラリへの単なる定数の追加は収録しない。
以下は各変更点に付けるべきタグです。
記号について(特に重要なものは大文字(主観))
* カテゴリ
* [ruby]: ruby インタプリタの変更
* [api]: 拡張ライブラリ API
* [lib]: ...