# Superclass of eigenclass in 1.8.6

**URL:** <https://www.ruby-forum.com/t/superclass-of-eigenclass-in-1-8-6/92194>\
**Category:** Ruby\
**Created:** [April 16, 2007, 11:55pm UTC](https://www.ruby-forum.com/t/superclass-of-eigenclass-in-1-8-6/92194 "2007-04-16T23:55:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paolo\_p](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecc23a/32.png) [@paolo\_p](https://www.ruby-forum.com/u/paolo_p)\
**Post date:** [April 16, 2007, 11:55pm UTC](https://www.ruby-forum.com/t/superclass-of-eigenclass-in-1-8-6/92194/1 "2007-04-16T23:55:50Z")

</div>

Test script:

class Object

# good old eigenclass accessor

def eigenclass; class \<\< self; self; end; end  
end

class A; end  
class B \< A; end  
b = B.new

p “super of eigen of b: #{b.eigenclass.superclass}”  
p “super of eigen of B: #{B.eigenclass.superclass}”  
p “super of eigen of A: #{A.eigenclass.superclass}”

Ruby 1.8.2 and Ruby 1.9 give the same result:

MacNusco:/usr/bin nusco$ ruby -v /strange.rb  
ruby 1.8.2 (2004-12-25) [universal-darwin8.0]  
“super of eigen of b: B”  
“super of eigen of B: #Class:A”  
“super of eigen of A: #Class:Object”

This is what I expected, and consistent with the way method lookup  
works for singleton methods in both objects and classes. On the other  
hand, Ruby 1.8.5 and 1.8.6 surprised me:

MacNusco:/ nusco$ ruby -v /strange.rb  
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1]  
“super of eigen of b: #Class:B”  
“super of eigen of B: #Class:Class”  
“super of eigen of A: #Class:Class”

What the heck?

Paolo Perrotta  
Bologna, Italy
