Class: Palmister::SimpleLineDiff
- Inherits:
-
Object
- Object
- Palmister::SimpleLineDiff
- Defined in:
- lib/palmister/simple_line_diff.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
- #change(event) ⇒ Object
-
#discard_a(event) ⇒ Object
This will be called when there is a line in A that isn't in B.
-
#discard_b(event) ⇒ Object
This will be called when there is a line in B that isn't in A.
-
#initialize ⇒ SimpleLineDiff
constructor
A new instance of SimpleLineDiff.
-
#match(event) ⇒ Object
This will be called with both lines are the same.
Constructor Details
#initialize ⇒ SimpleLineDiff
Returns a new instance of SimpleLineDiff.
5 6 7 |
# File 'lib/palmister/simple_line_diff.rb', line 5 def initialize @content = "" end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content
3 4 5 |
# File 'lib/palmister/simple_line_diff.rb', line 3 def content @content end |
Instance Method Details
#change(event) ⇒ Object
9 10 11 |
# File 'lib/palmister/simple_line_diff.rb', line 9 def change(event) @content << %Q|<span class="only_a">#{event.old_element}</span><br/>\n<span class="only_b">#{event.new_element}</span><br/>\n| end |
#discard_a(event) ⇒ Object
This will be called when there is a line in A that isn't in B
19 20 21 |
# File 'lib/palmister/simple_line_diff.rb', line 19 def discard_a(event) @content << %Q|<span class="only_a">#{event.old_element}</span><br/>\n| end |
#discard_b(event) ⇒ Object
This will be called when there is a line in B that isn't in A
24 25 26 |
# File 'lib/palmister/simple_line_diff.rb', line 24 def discard_b(event) @content << %Q|<span class="only_b">#{event.new_element}</span><br/>\n| end |
#match(event) ⇒ Object
This will be called with both lines are the same
14 15 16 |
# File 'lib/palmister/simple_line_diff.rb', line 14 def match(event) @content << %Q|<span class="match">#{event.old_element}</span><br/>\n| end |