Module: ViewsHelpers
- Defined in:
- lib/zitgit/helpers/views.rb
Instance Method Summary collapse
Instance Method Details
#strip_message(text, length) ⇒ Object
2 3 4 |
# File 'lib/zitgit/helpers/views.rb', line 2 def (text, length) text.length > length ? text[0, length] + '...' : text end |
#summ_line(line) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/zitgit/helpers/views.rb', line 6 def summ_line(line) line.match(/@@\s+-([^\s]+)\s+\+([^\s]+)\s+@@/) [Regexp.last_match(1), Regexp.last_match(2)].map{|item| parts = item.split(',') if parts.count == 2 parts[0] + '-' + (parts[0].to_i + parts[1].to_i).to_s else item end }.join(' -> ') end |