Guest User

Untitled

a guest
Feb 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. def truncate_description(length, end_string = ' ...')
  2. words = description.split()
  3. words = words[0..(length-1)].join(' ') + (words.length > length ? end_string : '')
  4. words
  5. end
Add Comment
Please, Sign In to add comment