Ruby Language Checking Algorithm