るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.089秒)
トップページ > クエリ:-[x] > クエリ:file[x] > クエリ:read[x] > クエリ:print[x] > クラス:ERB[x]

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file open
  4. file atime
  5. file separator

ライブラリ

検索結果

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

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

...equire 'erb'

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

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