Ruby exercise using a linked list