On 8/10/07, Scott Taylor [EMAIL PROTECTED] wrote:
On Aug 10, 2007, at 3:43 PM, David Chelimsky wrote:
On 8/7/07, Scott Taylor [EMAIL PROTECTED] wrote:
I have the following code, which yields instance eval's the block
given:
class Foo
def bar(blk)
instance_eval blk
On Aug 10, 2007, at 3:43 PM, David Chelimsky wrote:
On 8/7/07, Scott Taylor [EMAIL PROTECTED] wrote:
I have the following code, which yields instance eval's the block
given:
class Foo
def bar(blk)
instance_eval blk
end
def baz
yield
end
end
The effect of
I have the following code, which yields instance eval's the block given:
class Foo
def bar(blk)
instance_eval blk
end
def baz
yield
end
end
The effect of this is that self is reassigned:
Foo.new.bar do
# here, self is the instance of Foo
# created by new
end
Duh. I should be using and_return(), not and_yield(), since I am
actually returning the value
of the instance eval. The method in question takes one parameter, a
proc obj (as block). But
how can I get a handle on that object (since it is anonymous)?
Scott
On Aug 7, 2007, at 9:14 PM, Scott