Want to stay on top? Ruby Weekly is a once-weekly e-mail newsletter covering the latest Ruby and Rails news.
     Feed Icon

Making Ruby Methods Immutable

By Peter Cooper / September 24, 2008

puzzle_lock.jpgGarry Dolley has developed a Ruby module called "Immutable" (Github repository). It allows you to make your methods immutable. As Gary says, "provide it a list of methods you don’t want touched and it’ll make sure they can’t be redefined." Effectively, it's a smack-down against monkeypatching.

Gary developed immutable to ensure that ActiveSupport wouldn't interfere with his attempts to improve Rails' loading time by reimplementing some ActiveSupport methods in C (by redefining his own changes).

Other Posts to Enjoy

Twitter Mentions