class Card::Content::Diff::LCS::ExcludeeIterator

support class for LCS::Processor

Public Class Methods

new(list) click to toggle source
# File lib/card/content/diff/l_c_s/processor.rb, line 132
def initialize list
  @list = list
  @index = 0
  @chunk_index = 0
end
old_and_new(old_excludees, new_excludees) click to toggle source
# File lib/card/content/diff/l_c_s/processor.rb, line 125
def self.old_and_new old_excludees, new_excludees
  {
    old: new(old_excludees),
    new: new(new_excludees)
  }
end

Public Instance Methods

next() click to toggle source
# File lib/card/content/diff/l_c_s/processor.rb, line 142
def next
  if @index < @list.size &&
     @list[@index][:chunk_index] == @chunk_index
    res = @list[@index]
    @index += 1
    @chunk_index += 1
    res
  end
end
scan_and_record(record_array) { |ex| ... } click to toggle source
# File lib/card/content/diff/l_c_s/processor.rb, line 152
def scan_and_record record_array
  while (ex = self.next)
    if ex[:type] == :disjunction
      record_array << ex[:element]
    else
      yield ex[:element]
    end
  end
end
word_step() click to toggle source
# File lib/card/content/diff/l_c_s/processor.rb, line 138
def word_step
  @chunk_index += 1
end