るりまサーチ

最速Rubyリファレンスマニュアル検索!
26件ヒット [1-26件を表示] (0.139秒)

別のキーワード

  1. base digest
  2. base file
  3. base ==
  4. _builtin base_label
  5. base hexdigest

ライブラリ

検索結果

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]...