The Excerpt() function takes in a string and shortens it to the desired amount of characters, but without cutting into the middle of a word.
1.def Excerpt (FullString, CharCount = 200)
2. if FullString.length >= CharCount
3. ExcFullString = FullString[0, CharCount]
4. SplitFullString = ExcFullString.split(/\s/)
5. FullWords = SplitFullString.length
6. SplitFullString[0, FullWords-1].join(" ") + '...'
7. else
8. FullString
9. end
10.end