From: Robert Klemme Date: 2013-01-04T06:42:20+09:00 Subject: Re: Require a ruby project to automatically include the modules in classes defined in the same .rb file On Thu, Jan 3, 2013 at 4:58 AM, Marc Heiler wrote: > I would like to know how I could save one line of code. > However, what I now want to do is, use only require, > and have this module included into ALL classes of > the .rb file. In other words: > Is this possible? Is it desirable? Wouldn't the code be significantly harder to read? > The reason why I need this, before anyone asks: > > I have a global colourizer method, which I use > for ALL my ruby projects and all my ruby classes, > but optionally. I.e. I want to toggle and control > whether to use ansicolours or not. What does that mean? I mean what does this have to do with the module or the method? > The current code I have requires me to use an > explicit include, which is ok, but I'd rather > be able to eliminate one line of code, which > would in turn eliminate around 3000 lines of > code (the amount of classes I wrote in ruby so > far). If that method is so globally used you could include it in Object. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/