Re: [rspec-users] and_yield + instance_eval(block)

2007-08-10 Thread David Chelimsky
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

Re: [rspec-users] and_yield + instance_eval(block)

2007-08-10 Thread Scott Taylor
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

[rspec-users] and_yield + instance_eval(block)

2007-08-07 Thread Scott Taylor
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

Re: [rspec-users] and_yield + instance_eval(block)

2007-08-07 Thread Scott Taylor
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