Class: Proc
Instance Method Summary collapse
-
#self ⇒ Object
Returns the self of the receiver, which is the default context used in evaluating the receiver.
-
#self=(object) ⇒ Object
Sets the self of the receiver to the given object, modifying the used in evaluating the receiver.
Instance Method Details
#self ⇒ Object
Returns the self of the receiver, which is the default context used in evaluating the receiver.
845 846 847 848 849 |
# File 'ext/evilr/evilr.c', line 845 static VALUE evilr_self(VALUE self) { struct BLOCK *data; data = (struct BLOCK*)DATA_PTR(self); return data->self; } |
#self=(object) ⇒ Object
Sets the self of the receiver to the given object, modifying the used in evaluating the receiver. Example:
p = Proc.new{self[:a]}
h1 = {:a=>1}
h2 = {:a=>2}
p.self = h1
p.call # => 1
p.self = h2
p.call # => 2
865 866 867 868 869 870 |
# File 'ext/evilr/evilr.c', line 865 static VALUE evilr_self_e(VALUE self, VALUE obj) { struct BLOCK *data; data = (struct BLOCK*)DATA_PTR(self); data->self = obj; return data->self; } |