16 Jul 2010, 02:54
Generic-user-small

Mike Leary (1 post)

At about 4:30: “We no longer need the t, because self is going to be set to t”

If self really was going to be set to t, then t.secret might actually work (it didn’t), or t.instance_eval {secret} wouldn’t work any better than t.secret did (it does).

Edit:

At about 6:10, a bit ambiguous: “Every single time you use instance_eval ruby will create one of these ghost classes and make it the class of the receiver of the instance_eval”

Ruby makes it the first class object (right identifier?) searched during method lookup, but animal.class is still String, not the anonymous ghost class. “Receiver” is the object itself (animal, or rather: “cat”); “receiver” is not the [super]class in which the method lives, no?

01 Jul 2012, 16:01
Screen shot 2011-03-08 at 2.28.53 am_pragsmall

Giang NGUYEN (1 post)

Yeah at 4:38, the way to call “secret” inside block.

t.instance_eval { secret } works

but t.instance_eval { t.secret } doesn’t work, t.instance_eval { self.secret } doesn’t work as well.

so we MUST remove the “t” inside the block.

  You must be logged in to comment