cinchrb / cinch

The IRC Bot Building Framework
http://www.rubydoc.info/gems/cinch
MIT License
1k stars 180 forks source link

Bug with User.hash #31

Closed kixelated closed 13 years ago

kixelated commented 13 years ago

I have an application that uses Users as keys to a hash. When a user renames himself, Cinch will update the User instance to match the new nick. However, the problem is that this will also change the output of User.hash, and will require a rehash or else the key-value pair will be unaccessible.

My alternative is to use the host in the hash method, rather than the nick. The host will not always be unique which means hash lookups will be slower, but the host won't change and makes for a better hash function in general. Let me know what you guys.

dominikh commented 13 years ago

Unfortunately, the host can change as well.

kixelated commented 13 years ago

Alright, I suppose it's not hard to just rehash.