From: "Peña, Botp" Date: 2008-09-03T13:18:48+09:00 Subject: Re: How can I prevent include one module multi-times? From: Zhao Yi [mailto:youhaodeyi@gmail.com] # I am looking for a method to check whether this module has been # included. Does Ruby have this feature? you can query the class/module thru #included_modules eg, > class C > end => nil > C.included_modules => [Kernel] > module M > end => nil > class C > include M > end => C > C.included_modules => [M, Kernel] or if you want to query the whole program space, search the ObjectSpace eg, > ObjectSpace.each_object(Module).select{|m| m.class.name == "Module"} => [IRB, Exception2MessageMapper, Marshal, ObjectSpace, GC, Math, Process::Sys, Process::GID, Process::UID, Process, Signal, File::Constants, FileTest, Errno, Precision, Enumerable, Comparable, Kernel, Readline, RubyToken, IRB::Notifier, M, IRB::MethodExtender, IRB::ContextExtender, IRB::ExtendCommandBundle] kind regards -botp