On Sat, Oct 29, 2011 at 10:49, Faith Tarcha <faith / centrum.sk> wrote:

> I am suppose
> to generate "an" and "a" articles for the words in the arrays by using a
> new object.

Ask yourself how you do it as a human.  You look at the first letter
to see if it's a vowel, right?  (Omitting for now some special cases
like h and y under certain circumstances.)  So how do you get the
first letter of a string?

The big gotcha you may face is that in Ruby 1.8 (and before), a single
subscripted element of a String got you a *number*, which is the ASCII
code of the character there.  In 1.9, it does what most people would
expect, and gives you the single character as a string.  It would be
best to make your code portable between the two, such as extracting a
one-character substring.  (No I'm not going to tell you how to do
that, there are plenty of Ruby docs on the web.)

-Dave

-- 
LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages.
Where: Northern Virginia, Washington DC (near Orange Line), and remote work.
See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)