26件ヒット
[1-26件を表示]
(0.139秒)
ライブラリ
- ビルトイン (26)
検索結果
-
RubyVM
:: InstructionSequence # base _ label -> String (18120.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 # label -> String (7.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......seq = 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_label]...
