On Sun, Nov 6, 2011 at 12:59 PM, steve ross <cwdinfo / gmail.com> wrote:

> def article_for(noun)
> =A0article =3D %w(a e i o u).include?(noun[0..0]) ? 'an' : 'a'
> =A0"#{article} #{noun}"
> end
>
> irb(main):022:0> article_for 'dog'
> =3D> "a dog"
> irb(main):023:0> article_for 'animal'
> =3D> "an animal"

> article_for 'unicorn'
 =3D> "an unicorn"  # =3D> oops :-)

--=20
Hassan Schroeder ------------------------ hassan.schroeder / gmail.com
http://about.me/hassanschroeder
twitter: @hassan