るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.029秒)
トップページ > バージョン:2.4.0[x] > ライブラリ:ビルトイン[x] > クエリ:compile[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. mkmf try_compile
  2. _builtin compile
  3. kernel try_compile
  4. ripper compile_error
  5. regexp compile

クラス

キーワード

検索結果

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

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

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

self を文字列から作成していた場合は nil を返します。

例1:irb で実行した場合

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

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

# /tmp/method....

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

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

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

例1:irb で実行した場合

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

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

# /tmp/method.rb
def hello
puts "h...

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

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

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

トップレベルでは "<main>" を返します。self を文字列から作成していた場合
は "<compiled>" を返します。

例1:irb で実行した場合

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

例2: R...

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

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

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

self の作成時に指定した文字列を返します。self を文字列から作成していた
場合は "<compiled>" を返します。

例1:irb で実行した場合

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

例2: RubyVM::InstructionSequence.compi...

Regexp#~ -> Integer | nil (28.0)

変数 $_ の値との間でのマッチをとります。

変数 $_ の値との間でのマッチをとります。

ちょうど以下と同じ意味です。

//emlist[][ruby]{
self =~ $_
//}

//emlist[例][ruby]{
$_ = "hogehoge"

if /foo/
puts "match"
else
puts "no match"
end
# => no match
# ただし、警告がでる。warning: regex literal in condition

reg = Regexp.compile("foo")

if ~ reg
puts "match"
else
puts "no matc...

絞り込み条件を変える

RubyVM::InstructionSequence#disasm -> String (28.0)

self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。

self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。

puts RubyVM::InstructionSequence.compile('1 + 2').disasm

出力:

== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1 ( 1)
0002 putobject 1
0004 putobje...

RubyVM::InstructionSequence#disassemble -> String (28.0)

self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。

self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。

puts RubyVM::InstructionSequence.compile('1 + 2').disasm

出力:

== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1 ( 1)
0002 putobject 1
0004 putobje...

RubyVM::InstructionSequence#eval -> object (28.0)

self の命令シーケンスを評価してその結果を返します。

self の命令シーケンスを評価してその結果を返します。

RubyVM::InstructionSequence.compile("1 + 2").eval # => 3

RubyVM::InstructionSequence#first_lineno -> Integer (28.0)

self が表す命令シーケンスの 1 行目の行番号を返します。

self が表す命令シーケンスの 1 行目の行番号を返します。

例1:irb で実行した場合

RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1

例2:

# /tmp/method.rb
require "foo-library"
def foo
p :foo
end

RubyVM::InstructionSequence.of(method(:foo)).first_lineno
# => 2

RubyVM::InstructionSequence#inspect -> String (28.0)

self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。

self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。

//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
iseq.inspect # => "<RubyVM::InstructionSequence:<compiled>@<compiled>>"
//}

@see RubyVM::InstructionSequence#label,
RubyVM::InstructionSequence#path

絞り込み条件を変える

RubyVM::InstructionSequence#to_a -> Array (28.0)

self の情報を 14 要素の配列にして返します。

self の情報を 14 要素の配列にして返します。

命令シーケンスを以下の情報で表します。

: magic

データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。

: major_version

命令シーケンスのメジャーバージョン。

: minor_version

命令シーケンスのマイナーバージョン。

: format_type

データフォーマットを示す数値。常に 1。

: misc

以下の要素から構成される Hash オブジェクト。

:arg_size: メソッド、ブ...

RubyVM::InstructionSequence#to_binary(extra_data = nil) -> String (28.0)

バイナリフォーマットでシリアライズされたiseqのデータを文字列として返します。 RubyVM::InstructionSequence.load_from_binary メソッドでバイナリデータに対応するiseqオブジェクトを作れます。

バイナリフォーマットでシリアライズされたiseqのデータを文字列として返します。
RubyVM::InstructionSequence.load_from_binary メソッドでバイナリデータに対応するiseqオブジェクトを作れます。

引数の extra_data はバイナリデータと共に保存されます。
RubyVM::InstructionSequence.load_from_binary_extra_data メソッドでこの文字列にアクセス出来ます。

注意: 変換後のバイナリデータはポータブルではありません。 to_binary で得たバイナリデータは他のマシンに移動できません。他...