class Olelo::PatchSummary
Attributes
html[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/olelo/patch.rb, line 190 def initialize(options = {}) @options = options end
Public Instance Methods
begin!(src, dst)
click to toggle source
# File lib/olelo/patch.rb, line 204 def begin!(src, dst) @src, @dst = src, dst @ins = @del = 0 end
binary!()
click to toggle source
# File lib/olelo/patch.rb, line 225 def binary! @ins = @del = '-' end
deletion!(line)
click to toggle source
# File lib/olelo/patch.rb, line 233 def deletion!(line) @del += 1 end
end!()
click to toggle source
# File lib/olelo/patch.rb, line 209 def end! if @src && @dst if @src == @dst @html << %{<tr class="edit"><td class="name">#{link(escape_html @src)}</td><td class="ins">#{@ins}</td><td class="del">#{@del}</td></tr>} else text = "#{escape_html @src} → #{escape_html @dst}" @html << %{<tr class="move"><td class="name">#{link text}</td><td class="ins">#{@ins}</td><td class="del">#{@del}</td></tr>} end elsif @src @html << %{<tr class="delete"><td class="name">#{link(escape_html @src)}</td><td class="ins">#{@ins}</td><td class="del">#{@del}</td></tr>} else @html << %{<tr class="new"><td class="name">#{link(escape_html @dst)}</td><td class="ins">#{@ins}</td><td class="del">#{@del}</td></tr>} end @file += 1 end
finalize!()
click to toggle source
# File lib/olelo/patch.rb, line 199 def finalize! @html << %{<tr><td colspan="3">#{escape_html :no_changes.t}</td></tr>} if @file == 0 @html << "</tbody></table>" end
initialize!()
click to toggle source
# File lib/olelo/patch.rb, line 194 def initialize! @html = %{<table class="patch-summary"><thead><tr><th>#{escape_html :summary.t}</th><th class="ins">+</th><th class="del">-</th></tr></thead><tbody>} @file = 0 end
insertion!(line)
click to toggle source
# File lib/olelo/patch.rb, line 229 def insertion!(line) @ins += 1 end
link(text)
click to toggle source
# File lib/olelo/patch.rb, line 237 def link(text) @options[:links] ? %{<a href="#patch-#{@file}">#{text}</a>} : text end