Last active
December 15, 2015 15:19
-
-
Save Gorbatchevski/5280623 to your computer and use it in GitHub Desktop.
Translates a word into pig latin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def translate_into_pig_latin(word) | |
if word[0] == "a"|| word[0]== "e" || word[0] == "i"|| word[0] == "u" || word[0] == "o" | |
word+"ay" | |
elsif (word[0] != "a"|| word[0] != "e" || word[0] != "i"|| word[0] != "u") && (word[1] == "a" || word[1] == "o" || word[1] == "e" || word [1] == "i" || word[1] == "u") && word[0..1] != "qu" | |
word[1..-1]+word[0]+"ay" | |
elsif (word[0] != "a"|| word[0] != "e" || word[0] != "i"|| word[0] != "u") && (word[1] != "a" || word[1] != "o" || word[1] != "e" || word [1] != "i" || word[1] != "u") | |
word[2..-1]+word[0..1]+"ay" | |
elsif word[0..1]="qu" | |
word[2..-1]+"quay" | |
else | |
123 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment