Hi all, im trying to write a method that translates input into "pig latin" which basically adds an 'ay' at the end of a word and moves the first consonant, if any to the end of the word.

i havent written the entire code yet but this is what i have so far and im having problems with the 'consonants' section, it doesnt seem to return any strings.

def translate(strInput)
input=strInput.split #separate the input into an array of words in case the string is not a single word
vowels=['a','e','i','o','u']
consonants=[('a'..'z').to_a-vowels] #all alphabets minus vowels array
myInput=''
input.each do |input| #go through the 'input' array and pass each element as 'input'
vowels.each do |vowel| #go through vowels and check if a vowel matches first letter
if input[0]==vowel
myInput=input+'ay' #add an 'ay' to the word
end
myInput
end

if consonants.include?(input[0]) #check if the first letter if the word is a consonant
newSlice=input.slice(0) #save that letter
newInput=input.sub(/^./,'') #remove the letter
myInput=newInput+newSlice+"ay" #join the new strings with an 'ay' at the end
myInput
end

end
myInput
end
puts translate('apple')