Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Aliasing static methods in Ruby (and Rails)

By Peter Cooper / May 28, 2006

Simon Harris laments:

As much as I love Ruby on Rails, one of the things that dissapoints me is the rather large number of static methods. Maybe it's my Java background but class methods just irk me: They're difficult to override, mock, stub-out, and they're inherintly thread-unfriendly. But that aside, the fact remains that they exist and, now and again, I need to mess with them.

He proceeds to look at chaining methods with alias_method. This is an area where there's MTOWTDI (More Than One Way To Do It) and his examples are worth checking out.

Other Posts to Enjoy

Twitter Mentions