Issue #8026 has been updated by mame (Yusuke Endoh).


matz (Yukihiro Matsumoto) wrote:
> But according to the slide, the optional `include_ancestors` is true, but it does mean cherry-picking prepended modules from ancestor list.  I cannot think of any use case of this behavior.

I guess `include_ancestors` here means "modules prepended by prepended modules":

```
module A; end
module B; prepend A; end
module C; prepend B; end

C.prepended_modules(true)  #=> [A, B]
C.prepended_modules(false) #=> [B]
```

So, `include_ancestors` is not a good name; should it be called `include_descendants`?

@marcandre , am I right?

----------------------------------------
Feature #8026: Need Module#prepended_modules
https://bugs.ruby-lang.org/issues/8026#change-83258

* Author: marcandre (Marc-Andre Lafortune)
* Status: Feedback
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
We should have a way to get the list of prepended modules of a class or module.

    module Mixin
    end

    module Outer
      prepend Mixin
    end

    Mixin.prepended_modules   #=> []
    Outer.prepended_modules   #=> [Mixin]

See also bug #8025.

---Files--------------------------------
prepended.pdf (99.4 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>