![]() | Eigenclasses |
|
16 Feb 2010, 19:31
Frank (9 posts) |
I’m currently working my way through the Eigenclasses chapter. On page 144 there’s a line of code: obj.eigenclass.superclass # => D On Ruby 1.9.1 I don’t actually get ‘D’ as the result for that line of code. obj.class I’m missing something here or misunderstanding something. What is # and how does it |
|
26 Feb 2010, 16:43
Paolo Perrotta (38 posts) |
Hi, Frank. Sorry for the very late reply. I tried this in Ruby 1.9.1p376:
class Object
def eigenclass
class << self; self; end
end
end
class C; end
class D < C; end
obj = D.new
obj.eigenclass.superclass # => D
This tends to be an area where some versions of Ruby had bugs and regression. Maybe you can try it with the very latest Ruby 1.9? |
| You must be logged in to comment |

