Posted by Rick DeNatale
Tue, 04 Sep 2007 15:28:00 GMT
I’ve noticed that some rubyists like to use indentation to delineate method visibility.
The first time I noticed this was when Marcel Molina Jr. used it during the
charity testing workshop at the Ruby Hoedown.. I just encountered it again in at least one piece of sample code from Rob Orsini’s “Rails Cookbook.”
During the testing workshop, Chad Fowler expressed displeasure with this style, and I’ve got to agree.
Read more...
Posted in ruby, best_practices | Tags metaprogramming, style | 6 comments | no trackbacks
Posted by Rick DeNatale
Wed, 18 Jul 2007 19:45:00 GMT

I’ve been working on adding support for localization of the user’s time zone on an existing Rails app for a client. In order to test this, I found myself building a time machine.
At first, I did a fairly simple hack which monkey patched the system methods Time.now, and Date.today. This worked until I got into some testcases of code which was triggered off of updated_at fields in various ActiveRecord models. Since I had to deal with these implicit dates, I found that I needed to have finer control than my simple patch gave.
The code has now evolved to the point where I think that it shows some interesting aspects of basic Ruby metaprogramming.
Read more...
Posted in ruby, rails | Tags metaprogramming, testing | 1 comment | 1 trackback