Skip to content

Instantly share code, notes, and snippets.

@kathgironpe
Created November 17, 2009 23:14
Show Gist options
  • Save kathgironpe/237367 to your computer and use it in GitHub Desktop.
Save kathgironpe/237367 to your computer and use it in GitHub Desktop.
def teaser(text, wordcount, omission)
text.split[0..(wordcount-1)].join(" ") + (text.split.size > wordcount ? " " + omission : "")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment