Skip to content

Instantly share code, notes, and snippets.

@amiel
Created July 13, 2010 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amiel/474384 to your computer and use it in GitHub Desktop.
Save amiel/474384 to your computer and use it in GitHub Desktop.
def possessivize(owner)
owner.ends_with?('s') ? owner + "’" : owner + "’s"
end
@bensonk
Copy link

bensonk commented Jul 13, 2010

@lucas-nelson
Copy link

Alternative for those wanting to use a plain ascii ':

def possessivize(owner)
  "#{owner}'#{'s' unless owner.ends_with?('s')}"
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment