Module: GitCommitNotifier::EscapeHelper
- Included in:
- DiffToHtml, ResultProcessor
- Defined in:
- lib/git_commit_notifier/escape_helper.rb
Overview
Provides content escaping helpers.
Instance Method Summary collapse
-
#escape_content(s) ⇒ String
Escapes expanded content using CGI.escapeHTML and #expand_tabs.
-
#expand_tabs(s, tabWidth) ⇒ String
Expand tabs into spaces.
Instance Method Details
#escape_content(s) ⇒ String
Escapes expanded content using CGI.escapeHTML and #expand_tabs.
23 24 25 |
# File 'lib/git_commit_notifier/escape_helper.rb', line 23 def escape_content(s) CGI.escapeHTML((s, 4)).gsub(" ", " ") end |
#expand_tabs(s, tabWidth) ⇒ String
Expand tabs into spaces.
10 11 12 13 14 15 16 17 |
# File 'lib/git_commit_notifier/escape_helper.rb', line 10 def (s, tabWidth) delta = 0 s.gsub(/\t/) do |m| add = tabWidth - (delta + $~.offset(0)[0]) % tabWidth delta += add - 1 " " * add end end |