Forum: Ruby Getting the module of a class

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Florian W. (Guest)
on 2006-03-26 19:30
(Received via mailing list)
Hi!

Can anybody think of a better way to get the module of a class in a
module?

eval(some_class_in_a_module.to_s.gsub(/::[^:]*$/, ''))

Thanks!

Ciao!
Florian
This topic is locked and can not be replied to.