Skip to content

Instantly share code, notes, and snippets.

@thatandyrose
thatandyrose / string.rb
Created June 6, 2013 10:46
Add some grammar helpers to your String!
class String
def articleize
me = self.downcase
an_startswith = ['a','e','i','o','u']
an_exceptions = ['unit'] #add more when you think of them!
if me.start_with?(*(an_startswith + an_exceptions))
return "an #{self}"
else
return "a #{self}"