Xavier Noria
10/21/2006 1:37:00 PM
On Oct 21, 2006, at 2:45 PM, Artur Merke wrote:
> the question was (and still is), why(!)
>
> def a
> end
>
> and
>
> define_method(:a) do
> end
>
> behave differently in instance_eval (and not in class_eval and
> anywhere
> else) ...
Ah yes, I see it now. I join the question, a posteriori looks like
within instance_eval we are in the context of the singleton class of
D, because D.ii_method works. But puts self does not seem to output
that one there
irb(main):010:0> class D; instance_eval do; puts self; end; end
D
=> nil
irb(main):011:0> class D; puts (class << self; self; end); end
#<Class:D>
=> nil
so I don't understand it either.
-- fxn