Ruby code for anagram checker