From ca9413674ea70dc67ab517734af2e40dac21beef Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Wed, 26 Mar 2008 12:27:52 +0000 Subject: Improve documentation. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_support/core_ext/module/inclusion.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'activesupport/lib/active_support/core_ext/module/inclusion.rb') diff --git a/activesupport/lib/active_support/core_ext/module/inclusion.rb b/activesupport/lib/active_support/core_ext/module/inclusion.rb index efc00d6f28..4f23841645 100644 --- a/activesupport/lib/active_support/core_ext/module/inclusion.rb +++ b/activesupport/lib/active_support/core_ext/module/inclusion.rb @@ -1,4 +1,23 @@ class Module + # Returns the classes in the current ObjectSpace where this module has been + # mixed in according to Module#included_modules. + # + # module M + # end + # + # module N + # include M + # end + # + # class C + # include M + # end + # + # class D < C + # end + # + # p M.included_in_classes # => [C, D] + # def included_in_classes classes = [] ObjectSpace.each_object(Class) { |k| classes << k if k.included_modules.include?(self) } -- cgit v1.2.3