るりまサーチ (Ruby 2.7.0)

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

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l

ライブラリ

キーワード

検索結果

ERB#def_class(superklass=Object, methodname='erb') -> Class (19207.0)

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

...mlist[例][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_, 'rend...

ERB#result(b=TOPLEVEL_BINDING) -> String (18607.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 (607.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#set_eoutvar(compiler, eoutvar = &#39;_erbout&#39;) -> Array (607.0)

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

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

ERB
でeRubyスクリプトの出力をためていく変数を設定するために使用します。
この設定は ERB#new でも行えるため、通常はそちらを使用した方がより容易です。...