Module: Summarise::StringExtensions
- Included in:
- String
- Defined in:
- lib/summarise/string_extensions.rb
Instance Method Summary collapse
Instance Method Details
#summarisable?(length = 200) ⇒ Boolean
13 14 15 |
# File 'lib/summarise/string_extensions.rb', line 13 def summarisable?(length=200) return self.summarise(length) != self end |
#summarize(l = 200, args = {}) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/summarise/string_extensions.rb', line 4 def summarize(l=200, args={}) i = 0 summary = self.split.map{ |word| word if (i += word.length) < l}.compact.join(' ') if args[:suffix] && self != summary summary << args[:suffix] end summary end |