From: Intransition Date: 2011-12-07T00:34:12+09:00 Subject: Re: ANSI v1.4.0 released ------=_Part_608_24762615.1323185647246 Content-Type: multipart/alternative; boundary="----=_Part_609_9656968.1323185647246" ------=_Part_609_9656968.1323185647246 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Sunday, December 4, 2011 12:44:55 AM UTC-5, Marc Heiler wrote: > > But for this, class String has to be extended and I am a bit > conservative when modifying core classes these days. I'd wish there > would be a way to not globally modify core classes, and instead limit > them to a specific project. > There is a tendency to overly fret extensions to core classes. Used thoughtfully they make code more manageable and readable, and in practice rarely ever present a problem. Just follow some basic rules: * Utilize a popular library of extensions when you can. * Don't override Ruby's own methods. * Add only obvious and generally useful methods. * Put your extensions in a separate core_ext file/directory and document. * Be conscious of your core extensions and those in your dependencies. Maybe I will write a blog post up on the topic. In any case the ANSI gem only defines 4 core extensions: * String#ansi * String#ansi! * String#unansi * String#unansi! That's it. ------=_Part_609_9656968.1323185647246 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Sunday, December 4, 2011 12:44:55 AM UTC-5, Marc Heiler wrote:

But for this, class String has to= be extended and I am a bit
conservative when modifying core classes th= ese days. I'd wish there
would be a way to not globally modify core cla= sses, and instead limit
them to a specific project.

There is a tendency to overly fret extensions to core classes. Used thoug= htfully they make code more manageable and readable, and in pract= ice rarely ever present a problem. Just follow some basic rules:
=
* Utilize a popular library of extensions when you can.
<= /div>
* Don't override Ruby's own methods.
* Add only obvious= and generally useful methods.
* Put your extensions in a sep= arate core_ext file/directory and document.
* Be conscious of= your core extensions and those in your dependencies.

Maybe I will write a blog post up on the topic. In any case the ANS= I gem only defines 4 core extensions:

* String#ans= i
* String#ansi!
* String#unansi
* St= ring#unansi!

That's it.

<= /p>

------=_Part_609_9656968.1323185647246-- ------=_Part_608_24762615.1323185647246--