```So, basically, I'm trying to get the below code to work properly for
"piglatin".  I have gotten it to work with mulitple words, if the word
starts with a vowel, if the word starts with a consonant, and if the
word starts with two consonants.  This was a hell of a lot of trial and
error getting to this point.

However, I am stuck and need a little help getting unstuck.  One thing
about "piglatin" is that I need to turn words like "quale" into
"alequay".  Also I need to have words like "square" to turn into
"aresquay".  AKA, if qu shows up somewhere, I need those letters (and
any that proceed it) to shift to the back and ad an +ay to the end.

The below code is the code I was talking about and made myself.  I
realize some things could probably be "cleaner" about it, but I'm just
starting to learn so it will do for now.

Anyhow, I would love to somehow get unstuck with this.

def translate(words)
z=""
vowels=%w(a e i o u)
consonants=%w(b c d f g h j k l m n p q r s t v w x y z)
words.gsub(/\w+/) do |word|
#the word in a array
z=word.scan(/\w/)
#checks to see if first letter has a vowel
contains_vowels=vowels & z.first.split(",")
two_consonants=z[0..1] & consonants
three_consonants = z[0..2] & consonants

if(contains_vowels.size>=1)
z.join("")+"ay"
elsif(three_consonants.size==3)
x=z.shift(3)
z.join("")<<x.join("")+"ay"
elsif(two_consonants.size==2)
x=z.shift(2)
z.join("")<<x.join("")+"ay"
else
x=z.shift
z<<x+"ay"
z.join("")
end
end
end

--
Posted via http://www.ruby-forum.com/.

```