Ruby 2.6.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > RubyVM::InstructionSequenceクラス > compile

singleton method RubyVM::InstructionSequence.compile

compile(source, file = nil, path = nil, line = 1, options = nil) -> RubyVM::InstructionSequence[permalink][rdoc]
new(source, file = nil, path = nil, line = 1, options = nil) -> RubyVM::InstructionSequence

引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。

[PARAM] source:
Ruby のソースコードを文字列で指定します。
[PARAM] file:
ファイル名を文字列で指定します。
[PARAM] path:
引数 file の絶対パスファイル名を文字列で指定します。
[PARAM] line:
引数 source の 1 行目の行番号を指定します。
[PARAM] options:
コンパイル時のオプションを true、false、Hash オブジェクトのいずれかで指定します。詳細は RubyVM::InstructionSequence.compile_option= を参照してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>

[SEE_ALSO] RubyVM::InstructionSequence.compile_file