From: nobu@... Date: 2014-07-09T13:55:19+00:00 Subject: [ruby-core:63603] [ruby-trunk - Feature #10018] [Feedback] Consider adding Sub-Includes as in include Foo::bar Issue #10018 has been updated by Nobuyoshi Nakada. Tracker changed from Bug to Feature Description updated Status changed from Open to Feedback You can achieve it by "method transplanting". ~~~ruby class Foo define_method(:any?, Enumerable.instance_method(:any?)) end ~~~ Wrapper method like `Module#mix` may help you. http://www.slideshare.net/yukihiro_matz/rubyconf-2010-keynote-by-matz It has been removed finally, you can construct ---------------------------------------- Feature #10018: Consider adding Sub-Includes as in include Foo::bar https://bugs.ruby-lang.org/issues/10018#change-47658 * 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/