On Thu, Jan 3, 2013 at 4:58 AM, Marc Heiler <[email protected]> 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/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to