On Fri, Jun 27, 2008 at 10:17 AM, Shot (Piotr Szotkowski) <shot / hot.pl> wrote: > Iñáki Baz Castillo: > >> El Jueves, 26 de Junio de 2008, Shot (Piotr Szotkowski) escribi > >>> module MyProgram >>> class Logger >>> class << self >>> def debug >>> >>> end >>> end >>> end >>> end > >> Ok, this seems really ellegant and I've tested that I can call >> "Logger.debug..." in any submodule/subclass into the program :) > > :) > >> Just a question: Logger must use an instance of a class (real >> class Logger), so to store it I think the best option is using >> a @@class_variable into Logger module > > No by using class << self, you're operating on the Logger object > (an instance of the class Class), and you can access its *instance* > variables. <snip> Amen grep --recursive '@@' lib && echo "Classvariables are the root of all evil ;)" Cheers Robert