Method: RubyVM::InstructionSequence#label

Defined in:
iseq.c

#labelObject

Returns the label of this instruction sequence.

<main> if it’s at the top level, <compiled> if it was evaluated from a string.

For example, using irb:

iseq = RubyVM::InstructionSequence.compile(‘num = 1 + 2’) #=> <RubyVM::InstructionSequence:<compiled>@<compiled>> iseq.label #=> “<compiled>”

Using ::compile_file:

# /tmp/method.rb def hello

puts "hello, world"

end

# in irb > iseq = RubyVM::InstructionSequence.compile_file(‘/tmp/method.rb’) > iseq.label #=> <main>


2036
2037
2038
2039
2040
# File 'iseq.c', line 2036

static VALUE
iseqw_label(VALUE self)
{
    return rb_iseq_label(iseqw_check(self));
}