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 6661133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:14:30+00:00 2026-05-26T02:14:30+00:00

Where in the Rubinius source is the code that is responsible for including modules?(Specifically,

  • 0

Where in the Rubinius source is the code that is responsible for including modules?(Specifically, to place module as super class of object class.)

  • 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-05-26T02:14:31+00:00Added an answer on May 26, 2026 at 2:14 am

    If you look at the documentation for Module#include, you’ll find that it delegates to Module#append_features:

    Invokes Module.append_features on each parameter in reverse order.

    The documentation for Module#append_features, in turn, describes (very briefly) how the default Ruby mixin algorithm works:

    When this module is included in another, Ruby calls append_features in this module, passing it the receiving module in mod. Ruby’s default implementation is to add the constants, methods, and module variables of this module to mod if this module has not already been added to mod or one of its ancestors. See also Module#include.

    If you look at Module#append_features in the Rubinius sourcecode, you’ll find that it is an alias for Module#include_into:

    # Called when this Module is being included in another Module.
    # This may be overridden for custom behaviour. The default
    # is to add constants, instance methods and module variables
    # of this Module and all Modules that this one includes to +klass+.
    #
    # See also #include.
    #
    alias_method :append_features, :include_into
    

    So, finally, Module#include_into is the real deal:

    # Add all constants, instance methods and module variables
    # of this Module and all Modules that this one includes to +klass+
    #
    # This method is aliased as append_features as the default implementation
    # for that method. Kernel#extend calls this method directly through
    # Module#extend_object, because Kernel#extend should not use append_features.
    def include_into(klass)
      ...
    

    Your specific question:

    exactly to place module as super class of object class

    is answered in this loop:

    k = klass.direct_superclass
    while k
      if k.kind_of? Rubinius::IncludedModule
        # Oh, we found it.
        if k == mod
          # ok, if we're still within the directly included modules
          # of klass, then put future things after mod, not at the
          # beginning.
          insert_at = k unless superclass_seen
          add = false
          break
        end
      else
        superclass_seen = true
      end
    
      k = k.direct_superclass
    end
    

    Watch for insert_at.

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

Sidebar

Related Questions

In Rubinius, if you do rbx-head > Object.instance_methods.grep(/^_.*/) => [__extend__, __show__, __marshal__, __instance_of__, __instance_variable_get__,
Is there a web site that indicates which gems work on rubinius (or other
I am looking into Rubinius (2.0+) and its actors library for parallel computing challenges.
How do I deserialize in Psych to return an existing object, such as a
Possible Duplicates: How can a language's compiler be written in that language? implementing a
I've read that the latest version of the Ruby interpreter (YARV) will have substantial
I have a project that has alot of file manipulation. I am trying out
I've been programming in Ruby for a while now with just the standard MRI
I've developed a web interface for a legacy (vendor) database using Ruby on Rails.
My colleagues normally use C or Fortran for high performance calculations (math on large

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.