Class: Binding

Inherits:
Object show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#bodyBinding

Given a Binding, returns the Node for that Binding’s body.

On YARV, this will returning the Binding’s instruction sequence.

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'ext/internal/binding/binding.c', line 17

static VALUE binding_body(VALUE self)
{
#ifdef RUBY_VM
  rb_binding_t * binding;
  rb_env_t * env;
  GetBindingPtr(self, binding);
  GetEnvPtr(binding->env, env);
  return env->block.iseq->self;
#else
  struct BLOCK * b;
  if(rb_safe_level() >= 4)
  {
    /* no access to potentially sensitive data from the sandbox */
    rb_raise(rb_eSecurityError, "Insecure: can't get binding body");
  }
  Data_Get_Struct(self, struct BLOCK, b);
  return wrap_node(b->body);
#endif
}