Advanced Ruby
Q81 / 100

What is the Ruby "ancestors" chain and how does method resolution order (MRO) work with multiple included modules?

Correct! Well done.

Incorrect.

The correct answer is B) Ruby searches the ancestors array (class, then included/prepended modules, then superclass and its modules, etc.) in order, with later includes taking precedence over earlier ones for method lookup

B

Correct Answer

Ruby searches the ancestors array (class, then included/prepended modules, then superclass and its modules, etc.) in order, with later includes taking precedence over earlier ones for method lookup

Explanation

The ancestors method shows the linearized lookup order; when multiple modules are included, the most recently included one takes precedence (appears earlier in the chain) for method resolution.

Progress
81/100