ruby: anagram: methods for conditional checks