種類
- インスタンスメソッド (143)
- 特異メソッド (130)
ライブラリ
- ビルトイン (273)
キーワード
-
absolute
_ path (13) -
base
_ label (13) - compile (13)
-
compile
_ file (13) -
compile
_ option (13) -
compile
_ option= (13) - disasm (26)
- disassemble (26)
- eval (13)
-
first
_ lineno (13) - inspect (13)
- label (13)
-
load
_ from _ binary (13) -
load
_ from _ binary _ extra _ data (13) - new (13)
- of (13)
- path (13)
-
to
_ a (13) -
to
_ binary (13)
検索結果
先頭5件
-
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (1.0) -
self が表す命令シーケンスの絶対パスを返します。
...ます。
例1:irb で実行した場合
```ruby
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
p iseq
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
p iseq.absolute_path
# => nil
```
例2: [m:RubyVM::InstructionSequence.compile_file] を使用した場合
```console
# /tmp/......method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"
```
- **SEE** [m:RubyVM::InstructionSequence#path]... -
RubyVM
:: InstructionSequence # base _ label -> String (1.0) -
self が表す命令シーケンスの基本ラベルを返します。
...す。
例1:irb で実行した場合
```ruby
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
p iseq
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
p iseq.base_label
# => "<compiled>"
```
例2: [m:RubyVM::InstructionSequence.compile_file] を使用した場合
```console
# /t......seq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label # => "<main>"
```
```ruby title="例3"
# /tmp/method2.rb
def hello
puts "hello, world"
end
p RubyVM::InstructionSequence.of(method(:hello)).base_label
# => "hello"
```
- **SEE** [m:RubyVM::InstructionSequence#lab... -
RubyVM
:: InstructionSequence # disasm -> String (1.0) -
self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。
...ンスを人間が読める形式の文字列に変換して返します。
```ruby
puts RubyVM::InstructionSequence.compile('1 + 2').disasm
```
```text title="出力"
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1......( 1)
0002 putobject 1
0004 putobject 2
0006 opt_plus <ic:1>
0008 leave
```
- **SEE** [m:RubyVM::InstructionSequence.disasm]... -
RubyVM
:: InstructionSequence # disassemble -> String (1.0) -
self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。
...ンスを人間が読める形式の文字列に変換して返します。
```ruby
puts RubyVM::InstructionSequence.compile('1 + 2').disasm
```
```text title="出力"
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1......( 1)
0002 putobject 1
0004 putobject 2
0006 opt_plus <ic:1>
0008 leave
```
- **SEE** [m:RubyVM::InstructionSequence.disasm]... -
RubyVM
:: InstructionSequence # eval -> object (1.0) -
self の命令シーケンスを評価してその結果を返します。
...self の命令シーケンスを評価してその結果を返します。
```ruby
p RubyVM::InstructionSequence.compile("1 + 2").eval # => 3
```... -
RubyVM
:: InstructionSequence # first _ lineno -> Integer (1.0) -
self が表す命令シーケンスの 1 行目の行番号を返します。
...番号を返します。
例1:irb で実行した場合
```ruby
p RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1
```
```ruby title="例2"
# /tmp/method.rb
require "foo-library"
def foo
p :foo
end
p RubyVM::InstructionSequence.of(method(:foo)).first_lineno
# => 2
```... -
RubyVM
:: InstructionSequence # inspect -> String (1.0) -
self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。
...読みやすい文字列にして返します。
```ruby title="例"
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
p iseq.inspect # => "<RubyVM::InstructionSequence:<compiled>@<compiled>>"
```
- **SEE** [m:RubyVM::InstructionSequence#label],
[m:RubyVM::InstructionSequence#path]... -
RubyVM
:: InstructionSequence # label -> String (1.0) -
self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、モジュール名などで構成されます。
...す。
例1:irb で実行した場合
```ruby
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
p iseq
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
p iseq.label
# => "<compiled>"
```
例2: [m:RubyVM::InstructionSequence.compile_file] を使用した場合
```console
# /tmp/me......b
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.label # => "<main>"
```
```ruby title="例3"
# /tmp/method2.rb
def hello
puts "hello, world"
end
p RubyVM::InstructionSequence.of(method(:hello)).label
# => "hello"
```
- **SEE** [m:RubyVM::InstructionSequence#base_lab...
