るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.046秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:>[x] > クエリ:@[x] > クエリ:>>[x] > クエリ:compile[x]

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. complex >
  4. comparable >
  5. float >

キーワード

検索結果

RubyVM::InstructionSequence.compile(source, file = nil, path = nil, line = 1, options = nil) -> RubyVM::InstructionSequence (18263.0)

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

...クトを作成して返します。

@
param source Ruby のソースコードを文字列で指定します。

@
param file ファイル名を文字列で指定します。

@
param path 引数 file の絶対パスファイル名を文字列で指定します。

@
param line 引数 source の 1 行...
...かで指定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。

RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>

@
see RubyVM::InstructionSequence.compile_file...

RubyVM::InstructionSequence.new(source, file = nil, path = nil, line = 1, options = nil) -> RubyVM::InstructionSequence (3163.0)

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

...クトを作成して返します。

@
param source Ruby のソースコードを文字列で指定します。

@
param file ファイル名を文字列で指定します。

@
param path 引数 file の絶対パスファイル名を文字列で指定します。

@
param line 引数 source の 1 行...
...かで指定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。

RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>

@
see RubyVM::InstructionSequence.compile_file...

RubyVM::InstructionSequence#absolute_path -> String | nil (144.0)

self が表す命令シーケンスの絶対パスを返します。

...:InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
>
iseq = RubyVM::Instr...
...uctionSequence.compile_file('/tmp/method.rb')
>
iseq.absolute_path # => "/tmp/method.rb"

@
see RubyVM::InstructionSequence#path...

RubyVM::InstructionSequence#base_label -> String (144.0)

self が表す命令シーケンスの基本ラベルを返します。

...structionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
>
iseq = RubyVM::In...
...structionSequence.compile_file('/tmp/method.rb')
>
iseq.base_label # => "<main>"

例3:

# /tmp/method2.rb
def hello
puts "hello, world"
end

RubyVM::InstructionSequence.of(method(:hello)).base_label
# => "hello"

@
see RubyVM::InstructionSequence#label...

RubyVM::InstructionSequence#label -> String (144.0)

self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、 モジュール名などで構成されます。

..."<main>" を返します。self を文字列から作成していた場合
は "<compiled>" を返します。

例1:irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.label
# => "<compiled>"

...
...2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
>
iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
>
iseq.label # => "<main>"

例3:

# /tmp/method2.rb
def hello
puts "hello, world"...
...end

RubyVM::InstructionSequence.of(method(:hello)).label
# => "hello"

@
see RubyVM::InstructionSequence#base_label...

絞り込み条件を変える

RubyVM::InstructionSequence#path -> String (144.0)

self が表す命令シーケンスの相対パスを返します。

...ていた
場合は "<compiled>" を返します。

例1:irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した...
...場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
>
iseq = RubyVM::InstructionSequence.compile_file('method.rb')
>
iseq.path # => "method.rb"

@
see RubyVM::InstructionSequence#absolute_path...