Removing duplicates from a linked list using ruby