# File lib/diff/lcs/htmldiff.rb, line 16 def initialize(output, options = {}) @output = output options ||= {} @match_class = options[:match_class] || "match" @only_a_class = options[:only_a_class] || "only_a" @only_b_class = options[:only_b_class] || "only_b" end
This will be called when there is a line in A that isn't in B
# File lib/diff/lcs/htmldiff.rb, line 37 def discard_a(event) @output << htmlize(event.old_element, :only_a_class) end
This will be called when there is a line in B that isn't in A
# File lib/diff/lcs/htmldiff.rb, line 42 def discard_b(event) @output << htmlize(event.new_element, :only_b_class) end
This will be called with both lines are the same
# File lib/diff/lcs/htmldiff.rb, line 32 def match(event) @output << htmlize(event.old_element, :match_class) end
# File lib/diff/lcs/htmldiff.rb, line 25 def htmlize(element, css_class) element = " " if element.empty? %Q<pre class="#{__send__(css_class)}">#{element}</pre>\n| end