Class: Diff::LCS::NoReplaceDiffCallbacks
- Inherits:
-
Object
- Object
- Diff::LCS::NoReplaceDiffCallbacks
- Defined in:
- lib/callbacks.rb
Instance Attribute Summary collapse
-
#diffs ⇒ Object
readonly
Returns the difference set collected during the diff process.
Instance Method Summary collapse
- #change(event) ⇒ Object
- #discard_a(event) ⇒ Object
- #discard_b(event) ⇒ Object
-
#initialize {|_self| ... } ⇒ NoReplaceDiffCallbacks
constructor
:yields self:.
- #match(event) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ NoReplaceDiffCallbacks
:yields self:
10 11 12 13 |
# File 'lib/callbacks.rb', line 10 def initialize @diffs = [] yield self if block_given? end |
Instance Attribute Details
#diffs ⇒ Object (readonly)
Returns the difference set collected during the diff process.
7 8 9 |
# File 'lib/callbacks.rb', line 7 def diffs @diffs end |
Instance Method Details
#change(event) ⇒ Object
27 28 29 30 31 |
# File 'lib/callbacks.rb', line 27 def change(event) discard_a(Diff::LCS::ContextChange.new("<", event.old_position, event.old_element, nil, nil)) discard_b(Diff::LCS::ContextChange.new(">", nil, nil, event.new_position, event.new_element)) # @diffs << Diff::LCS::ContextChange.simplify(event) end |
#discard_a(event) ⇒ Object
19 20 21 |
# File 'lib/callbacks.rb', line 19 def discard_a(event) @diffs << Diff::LCS::ContextChange.simplify(event) end |