Description
smart_truncate is a simple Rails gem that truncates text like a human. Ever wanted to truncate some text till the Ntn character only to find a word or sentence was cut in half? SmartTruncate fixes that."
SmartTruncate alternatives and similar gems
Based on the "Misc" category.
Alternatively, view SmartTruncate alternatives based on common mentions on social networks and blogs.
-
Gollum
A simple, Git-powered wiki with a local frontend and support for many kinds of markup and content. -
DeepPluck
Allow you to pluck attributes from nested associations without loading a bunch of records.
Scout Monitoring - Performance metrics and, now, Logs Management Monitoring with Scout Monitoring
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SmartTruncate or a related project?
README
SmartTruncate
smart_truncate is a simple Rails gem that truncates text like a human. Ever wanted to truncate some text till the Ntn character only to find a word or sentence was cut in half? SmartTruncate fixes that."
INSTALL
gem install smart_truncate
BASIC smart_truncate USE
# truncate by characters and it will end in a meaningful word
SmartTruncate.by_chars("I am a nice sentance… Previous sentence is not with a proper multicolon ending.",26,'!')
# => "I am a nice sentance… Previous!"
# truncate by sentence
SmartTruncate.by_sentences("I am a nice sentance ... Previous sentence is not with a proper multicolon ending.",1)
# => "I am a nice sentance ..."
# truncate mixed by both sentence and characters/words
SmartTruncate.by_mixed("I am a nice sentance. Previous sentence is with a proper multicolon ending.",2,10)
# => "I am a nice."
SmartTruncate.by_mixed("I am a nice sentance. Previous sentence is with a proper multicolon ending.",1,100)
# => "I am a nice sentance."
LICENSE
This project uses MIT-LICENSE.
*Note that all licence references and agreements mentioned in the SmartTruncate README section above
are relevant to that project's source code only.