Method: RubyVM::InstructionSequence#eval
- Defined in:
- iseq.c
#eval ⇒ Object
Evaluates the instruction sequence and returns the result.
RubyVM::InstructionSequence.compile("1 + 2").eval #=> 3
1930 1931 1932 1933 1934 1935 1936 1937 1938 |
# File 'iseq.c', line 1930
static VALUE
iseqw_eval(VALUE self)
{
const rb_iseq_t *iseq = iseqw_check(self);
if (0 == ISEQ_BODY(iseq)->iseq_size) {
rb_raise(rb_eTypeError, "attempt to evaluate dummy InstructionSequence");
}
return rb_iseq_eval(iseq);
}
|