Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9084223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:57:00+00:00 2026-06-16T20:57:00+00:00

According to Dave Thomas in his talk about the Ruby Object Model , there

  • 0

According to Dave Thomas in his talk about the Ruby Object Model, there are no “class methods” in Ruby. There is only difference between whether the receiver of the method is a “class object” or an “instance object”.

class Dave
  def InstaceMethod              ### will be stored in the current class (Dave)
    puts "Hi"
  end
  class << self                  ### Creates an eigenclass, if not created before
    def say_hello
      puts "Hello"
    end
  end
end

By default, ancestors method doesn’t show the metaclass:

class Dave
  class << self
    def metaclass                ### A way to show the hidden eigenclass
      class << self; self; end
    end
  end
end

p Dave.ancestors
# => [Dave, Object, Kernel, BasicObject]
p Dave.metaclass.ancestors
# => [Class, Module, Object, Kernel, BasicObject]

However, I assume the real one would be something like:

# => [<eigenclass>, Class, Module, Object, Kernel, BasicObject]

p Dave.class.instance_method(false)
# => [:allocate, :new, :superclass]
p Dave.metaclass.instance_method(false)
# => [:say_hello, :metaclass]

Now the inheritence.

class B < Dave
end

p B.say_hello
# => "Hello"
p B.ancestors
# => [B, Dave, Object, Kernel, BasicObject]
p B.class.instance_methods(false)
# => [:allocate, :new, :superclass]

The following would create a new eigenclass for B:

p B.metaclass.ancestors
# => [Class, Module, Object, Kernel, BasicObject]
p B.metaclass.instance_method(false)
# => []
  1. How would the B.ancestors and B.metaclass.ancestors look like when the eigenclasses are also included? The method say_hello is stored in an eigenclass, (which I assume B.class inherits from) but where is that?

  2. Since there are two ancestor chains (B.ancestors and B.class.ancestors or B.metaclass.ancestors), how does the inheritance actually take place?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:57:01+00:00Added an answer on June 16, 2026 at 8:57 pm

    Eigenclass is a sneaky hidden one. You have successfully revealed it by opening class. But it does not exist in the ancestors of normal class. And since it is hidden, you cannot see it by sending ancestors method to a eigenclass itself. The inheritance tree is like the following:

    B ---S-->  Dave   ---S---> Object  ---S---> BasicObject
    |            |               |                  |
    E            E               E                  E
    |            |               |                  |
    #B --S--> #Dave   ---S---> #Object ---S---> #BasicObject --S---> Class,,Object,BasicObject
    

    S stands for superclass, while E for eigenclass.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to the answers in this comparison question , there's no technical difference between
According to the Ruby Set class's documentation, == Returns true if two sets are
According to the introduction about ReaderT , I can only find: ReaderT Env IO
According this article , generic JPA DAO(Data Access Object) is a pretty nice pattern.
In the book Fortran 95/2003 for Scientists and Engineers , there is much talk
According to the official documentation, when there is a new RawContact inserted to the
According to the Ruby on Rails Guide: Caching , caching is disabled by default
According to this great article about HTTP uploads by Scott Hanselman, the browser typically
According to the C++0x spec , the following is legal class A { A(int
According to this article from Herb Sutter, one should always pick Class Specializing over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.