Issue #10018 has been updated by Robert A. Heiler.


Oops sorry!

This is not a bug, it is a feature request.

I am not sure how to move it to features now, sorry. :(

----------------------------------------
Bug #10018: Consider adding Sub-Includes as in include Foo::bar
https://bugs.ruby-lang.org/issues/10018#change-47657

* Author: Robert A. Heiler
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
On IRC someone asked a nice question:


<arup_r> 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:

  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/