On 28/08/2009, at 4:39 PM, Sonia Hamilton wrote: > def eql?(other) > [name].eql?([other.name]) > end > def hash > [name].hash > end
Note that your hash function creates an extra Array, and your eql? creates *two*. This is rather slow, and looks completely unnecessary. You should just say: def eql?(other) name.eql?(other.name) end def hash name.hash end Clifford Heath. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en -~----------~----~----~----~------~----~------~--~---
