module ReplyLayout
ReplyLayout — fixed progress gutter width for aligned multi-line IRC body text. Public: PROGRESS_GUTTER_WIDTH, body_start_column, strip_progress_gutter, align_colon_body Depends: MessageProgress, TextAlign Tests: test/lib/reply_layout_test.rb
Constants
- PROGRESS_GUTTER_WIDTH
Public Instance Methods
Source
# File lib/reply_layout.rb, line 35 def align_colon_body(rows) TextAlign.format_colon_rows(Array(rows)) end
Source
# File lib/reply_layout.rb, line 16 def body_start_column PROGRESS_GUTTER_WIDTH + 1 end
Source
# File lib/reply_layout.rb, line 27 def progress_gutter?(plain_line) text = plain_line.to_s return false if text.length < 3 head = text[0, 4] head.match?(/\A\d% \z/) || head.match?(/\A\d{2} \z/) || text[0, 2].match?(/\A\d%/) end
Source
# File lib/reply_layout.rb, line 20 def strip_progress_gutter(line) plain = line.to_s.gsub(TextAlign::IRC_CTRL_PATTERN, "") return plain unless progress_gutter?(plain) plain[PROGRESS_GUTTER_WIDTH..].to_s.lstrip end