------ art_42489_1037708.1184361591072 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/13/07, Mike Moore <blowmage / gmail.com> wrote: > > Thanks Peter. I didn't mean to sniff at a single 'tr', I was just hoping > for a better way. Right now I have my 'to_base26' and 'from_base26' > methods > on Numeric and String respectively, but I think I might monkey-patch > 'to_s' > and 'to_i' and add the base 26 logic when the 'base' argument is 26. You can do it whichever way you want, of course, but in terms of good coding practices I'd advise not monkey patching to_s and to_i in this way as it could break expected behavior (for libraries you use, etc). Monkey patching is okay to add features, but /changing/ existing features can get messy. Unless, of course, you add an optional param and detect that instead (e.g. to_s(base, start ') .. then use .to_s(26, 'a') for yourself), but by that point it's possibly easier just to make your own methods. Cheers, Peter Cooper http://www.rubyinside.com/ ------ art_42489_1037708.1184361591072--