Skip to content

Instantly share code, notes, and snippets.

@maryrosecook
Created March 13, 2009 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maryrosecook/78374 to your computer and use it in GitHub Desktop.
Save maryrosecook/78374 to your computer and use it in GitHub Desktop.
VOWELS = ["a", "e", "i", "o", "u"]
def self.indefinite_article(str)
article = ""
VOWELS.include?(str.to_s[0..0].downcase) && !str.to_s[1..1].match(/[A-Z]/) ? article = "An" : article = "A" if str
return article
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment