annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a1c9fadc0904 Initial.
edogawaconan <me@myconan.net>
parents:
diff changeset
1 module ApplicationHelper
15
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents: 0
diff changeset
2 include Twitter::Autolink
80
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
3
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
4 def ellipsize(text, limit = 60)
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
5 if text.length <= limit
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
6 text
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
7 else
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
8 "#{text.first(limit)}..."
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
9 end
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
10 end
0
a1c9fadc0904 Initial.
edogawaconan <me@myconan.net>
parents:
diff changeset
11 end