Project

General

Profile

Feature #10018

Updated by nobu (Nobuyoshi Nakada) about 6 years ago

On IRC someone asked a nice question: 


 > \<arup_r\> <arup_r> If I write `class class Foo; include Enumerable; end` end This code include all methods from `Enumerable`. Enumerable. But suppose I want to include `#all?`, `#any?` #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.

Back