Mercurial > rsstweet
diff app/helpers/application_helper.rb @ 80:448a368f7344
More useful title?
author | nanaya <me@myconan.net> |
---|---|
date | Sun, 26 Jun 2016 18:18:54 +0900 |
parents | 207917e41964 |
children | f91e2d00f03f |
line wrap: on
line diff
--- a/app/helpers/application_helper.rb Sun Jun 26 18:05:41 2016 +0900 +++ b/app/helpers/application_helper.rb Sun Jun 26 18:18:54 2016 +0900 @@ -1,3 +1,11 @@ module ApplicationHelper include Twitter::Autolink + + def ellipsize(text, limit = 60) + if text.length <= limit + text + else + "#{text.first(limit)}..." + end + end end