--- !ruby/object:RI::ClassDescription 
attributes: []

class_methods: []

comment: 
- !ruby/struct:SM::Flow::P 
  body: "This will produce a compound array of contextual diff change objects. Each element in the #diffs array is a &quot;hunk&quot; array, where each element in each &quot;hunk&quot; array is a single change. Each change is a Diff::LCS::ContextChange that contains both the old index and new index values for the change. The &quot;hunk&quot; provides the full context for the changes. Both old and new objects will be presented for changed objects. <tt>nil</tt> will be substituted for a discarded object."
- !ruby/struct:SM::Flow::VERB 
  body: "    seq1 = %w(a b c e h j l m n p)\n    seq2 = %w(b c d e f j k l m r s t)\n\n    diffs = Diff::LCS.diff(seq1, seq2, Diff::LCS::ContextDiffCallbacks)\n      # This example shows a simplified array format.\n      # [ [ [ '-', [  0, 'a' ], [  0, nil ] ] ],   # 1\n      #   [ [ '+', [  3, nil ], [  2, 'd' ] ] ],   # 2\n      #   [ [ '-', [  4, 'h' ], [  4, nil ] ],     # 3\n      #     [ '+', [  5, nil ], [  4, 'f' ] ] ],\n      #   [ [ '+', [  6, nil ], [  6, 'k' ] ] ],   # 4\n      #   [ [ '-', [  8, 'n' ], [  9, nil ] ],     # 5\n      #     [ '+', [  9, nil ], [  9, 'r' ] ],\n      #     [ '-', [  9, 'p' ], [ 10, nil ] ],\n      #     [ '+', [ 10, nil ], [ 10, 's' ] ],\n      #     [ '+', [ 10, nil ], [ 11, 't' ] ] ] ]\n"
- !ruby/struct:SM::Flow::P 
  body: The five hunks shown are comprised of individual changes; if there is a related set of changes, they are still shown individually.
- !ruby/struct:SM::Flow::P 
  body: "This callback can also be used with Diff::LCS#sdiff, which will produce results like:"
- !ruby/struct:SM::Flow::VERB 
  body: "    diffs = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextCallbacks)\n      # This example shows a simplified array format.\n      # [ [ [ &quot;-&quot;, [  0, &quot;a&quot; ], [  0, nil ] ] ],  # 1\n      #   [ [ &quot;+&quot;, [  3, nil ], [  2, &quot;d&quot; ] ] ],  # 2\n      #   [ [ &quot;!&quot;, [  4, &quot;h&quot; ], [  4, &quot;f&quot; ] ] ],  # 3\n      #   [ [ &quot;+&quot;, [  6, nil ], [  6, &quot;k&quot; ] ] ],  # 4\n      #   [ [ &quot;!&quot;, [  8, &quot;n&quot; ], [  9, &quot;r&quot; ] ],    # 5\n      #     [ &quot;!&quot;, [  9, &quot;p&quot; ], [ 10, &quot;s&quot; ] ],\n      #     [ &quot;+&quot;, [ 10, nil ], [ 11, &quot;t&quot; ] ] ] ]\n"
- !ruby/struct:SM::Flow::P 
  body: The five hunks are still present, but are significantly shorter in total presentation, because changed items are shown as changes (&quot;!&quot;) instead of potentially &quot;mismatched&quot; pairs of additions and deletions.
- !ruby/struct:SM::Flow::P 
  body: "The result of this operation is similar to that of Diff::LCS::SDiffCallbacks. They may be compared as:"
- !ruby/struct:SM::Flow::VERB 
  body: "    s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == &quot;=&quot; }\n    c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten\n\n    s == c # -&gt; true\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Use
- !ruby/struct:SM::Flow::P 
  body: This callback object must be initialised and can be used by the Diff::LCS#diff or Diff::LCS#sdiff methods.
- !ruby/struct:SM::Flow::VERB 
  body: "    cbo = Diff::LCS::ContextDiffCallbacks.new\n    Diff::LCS.LCS(seq1, seq2, cbo)\n    cbo.finish\n"
- !ruby/struct:SM::Flow::P 
  body: "Note that the call to #finish is absolutely necessary, or the last set of changes will not be visible. Alternatively, can be used as:"
- !ruby/struct:SM::Flow::VERB 
  body: "    cbo = Diff::LCS::ContextDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }\n"
- !ruby/struct:SM::Flow::P 
  body: "The necessary #finish call will be made."
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Simplified Array Format
- !ruby/struct:SM::Flow::P 
  body: "The simplified array format used in the example above can be obtained with:"
- !ruby/struct:SM::Flow::VERB 
  body: "    require 'pp'\n    pp diffs.map { |e| e.map { |f| f.to_a } }\n"
constants: []

full_name: Diff::LCS::ContextDiffCallbacks
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: change
- !ruby/object:RI::MethodSummary 
  name: discard_a
- !ruby/object:RI::MethodSummary 
  name: discard_b
name: ContextDiffCallbacks
superclass: Diff::LCS::DiffCallbacks
