Module: StringOverflow
- Defined in:
- string_overflow.rb
Overview
Jekyll filter for shortening a string and appending ellipses.
Instance Method Summary collapse
Instance Method Details
#shorten(string, max_length) ⇒ Object
8 9 10 11 12 13 14 |
# File 'string_overflow.rb', line 8 def shorten(string, max_length) if string.length > max_length "#{string[0, max_length - 1]}…" else string end end |