January 2009
4 posts
1 tag
Using the Ruby Array#uniq with custom classes
You may (or may not) have noticed that when you create a custom class in Ruby, Array#uniq — and friends — no longer work as advertised. You can override the eql?, equal?, ==, and still not get it right. For the solution, you must override both the eql? and hash member methods of your custom object: class MyFoo attr_reader :custom_unique_id # Internally, Ruby converts your...
Jan 27th
1 tag
Jan 25th
1 tag
WatchWatch
Fox News, Fear Imbalance. God, I hate Fox News. Smite them, please.
Jan 23rd
1 tag
Jan 14th