Class: Proc
Instance Method Summary collapse
-
#file ⇒ Object
Returns the file in which the proc body is defined, or nil.
-
#line ⇒ Object
Returns the line at which the proc body is defined, or nil.
-
#same_body?(other) ⇒ Boolean
Returns true if
self
andother
have the same body.
Instance Method Details
#file ⇒ Object
Returns the file in which the proc body is defined, or nil
77 78 79 80 81 82 83 84 85 86 87 |
# File 'ext/utilrb_ext.cc', line 77
static VALUE proc_file(VALUE self)
{
struct BLOCK *data;
NODE *node;
Data_Get_Struct(self, struct BLOCK, data);
if ((node = data->frame.node) || (node = data->body))
return rb_str_new2(node->nd_file);
else
return Qnil;
}
|
#line ⇒ Object
Returns the line at which the proc body is defined, or nil
94 95 96 97 98 99 100 101 102 103 104 |
# File 'ext/utilrb_ext.cc', line 94
static VALUE proc_line(VALUE self)
{
struct BLOCK *data;
NODE *node;
Data_Get_Struct(self, struct BLOCK, data);
if ((node = data->frame.node) || (node = data->body))
return INT2FIX(nd_line(node));
else
return Qnil;
}
|
#same_body?(other) ⇒ Boolean
Returns true if self
and other
have the same body
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'ext/utilrb_ext.cc', line 59
static VALUE proc_same_body_p(VALUE self, VALUE other)
{
if (self == other) return Qtrue;
if (TYPE(other) != T_DATA) return Qfalse;
if (RDATA(other)->dmark != RDATA(self)->dmark) return Qfalse;
if (CLASS_OF(self) != CLASS_OF(other)) return Qfalse;
struct BLOCK* data, *data2;
Data_Get_Struct(self, struct BLOCK, data);
Data_Get_Struct(other, struct BLOCK, data2);
return (data->body == data2->body) ? Qtrue : Qfalse;
}
|