From: matz@... Date: 2014-07-10T00:49:07+00:00 Subject: [ruby-core:63618] [ruby-trunk - Feature #10018] Consider adding Sub-Includes as in include Foo::bar Issue #10018 has been updated by Yukihiro Matsumoto. And method transplanting only works when the method does not call super nor other Enumerable methods. Automatic resolving is possible, but it would make inclusion far more complex. Matz. ---------------------------------------- Feature #10018: Consider adding Sub-Includes as in include Foo::bar https://bugs.ruby-lang.org/issues/10018#change-47671 * Author: Robert A. Heiler * Status: Feedback * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- On IRC someone asked a nice question: > \ If I write `class Foo; include Enumerable; end` This code include all methods from `Enumerable`. But suppose I want to include `#all?`, `#any?` .. What's the way to include only required methods ? This prompted me to write this. What if ruby would allow us to include just singular methods? Something like: ~~~ruby include Enumerable::any? ~~~ And so forth, so that we could cherry-pick what we want. This is already possible in some projects, like facets. But I think they solve it by splitting up the whole stuff into individual files, and then including this. I think it would be nicer if include itself would support a scope-mechanic. -- https://bugs.ruby-lang.org/