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

  • Home
  • SEARCH
  • 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 8694835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:52:50+00:00 2026-06-13T00:52:50+00:00

When the ancestors of a module are displayed, for example with String : String,

  • 0

When the ancestors of a module are displayed, for example with String:

String, Comparable, Object, Kernel, BasicObject

some of them (String, Object, BasicObject) are classes and others are not. Is there a notation to distinguish them? A possible candidate that came to mind was to use << instead of < for module inclusion:

String << Comparable < Object << Kernel < BasicObject

or conversely for class inheritance:

String < Comparable << Object < Kernel << BasicObject

but I am not sure. If there is no notation already out there, what do you think about the above? How is this expressed in UML?

  • 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-13T00:52:52+00:00Added an answer on June 13, 2026 at 12:52 am

    There is no such notation that I know of.

    For the most part, though, I don’t think one is necessary. In general (there are likely caveats here, but I can’t think of any right now), once a module is part of the ancestor chain, it behaves just like a class in the ancestor chain. To use your String example, ''.is_a? Comparable returns true and you calling super in a method within String that Comparable defines will call Comparable’s implementation.

    The only difference is with regard to initialize, since you can’t create an instance of a Module.

    As for UML, given this, it can just be a normal ancestor just like a class (I think), as I don’t believe UML has any way different way of representing modules.

    Personally, I think your proposed notation is a bit hard to parse, and when I do care would rather just see it all spelled out:

    a = String.ancestors
    a.map{ |c| c.class.to_s.downcase }.zip(a).map { |o| o.join(' ') }.join(' < ')
    #=> "class String < module Comparable < class Object < module PP::ObjectMixin < module Kernel < class BasicObject"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some interesting output from irb: irb(main):001:0> Class.ancestors => [Class, Module, Object, Kernel, BasicObject] irb(main):002:0>
I can easily ascend the class hierarchy in Ruby: String.ancestors # [String, Enumerable, Comparable,
What, if any, c++ constructs are there for listing the ancestors of a class
Given a Class object, how do I check if one of its ancestors is
I am extending a module and I want some tips on good practices. Specially
I have urls with references to folders that are not direct ancestors of the
def Ancestors (otu,tree): if tree[otu][0][0] == None: return [] else: return [otu,tree[otu][0][0]] + Ancestors
I have a table with a column ancestry holding a list of ancestors formatted
I'm trying to test if an attribute on an ancestor of an element not
Can anyone tell or define more what is ancestor and give an example on

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.