Created
August 2, 2013 01:15
-
-
Save Jdtanacredi/6136794 to your computer and use it in GitHub Desktop.
Revisions
-
Jdtanacredi created this gist
Aug 2, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ def translate pigLatin # difference between .. & ... again? //CHECKED alphabet = ('a'..'z').to_a # easiest method, make array? //CHECKED vowel = %w[a e i o u] # %w foo bar / "word array" consonant = alphabet - vowel #use if else/if #vowel if vowel.include?(pigLatin[0]) pigLatin + 'ay' #2 consonants elsif consonant.include?(pigLatin[0]) && consonant.include?(pigLatin[1]) pigLatin[2..-1] + pigLatin[0..1] + 'ay' elsif consonant.include?(pigLatin[0]) pigLatin[1..-1] + pigLatin[0] + 'ay' elsif word[0..1] == "qu" word[2..word.length]+"quay" elsif word[0..2] == "squ" word[3..word.length]+"squay" end end