Post by Peter Cooper on September 24th, 2008
Making Ruby Methods Immutable

- A Complete Guide to Using RubyInline for Optimization
- Adding extra data / time formats to your Rails application
- RailsBrain: Fast, AJAX-powered Rails documentation


Garry 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).

Click here to add on del.icio.us
Tweet This








