Class: WordRunDiffLCS::WordRunContextChangeSequence

Inherits:
Object
  • Object
show all
Defined in:
lib/word_run_diff_lcs.rb

Instance Method Summary collapse

Constructor Details

#initializeWordRunContextChangeSequence

Returns a new instance of WordRunContextChangeSequence.



29
30
31
# File 'lib/word_run_diff_lcs.rb', line 29

def initialize
  @word_run_context_changes = [ ]
end

Instance Method Details

#<<(diff_lcs_context_change) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/word_run_diff_lcs.rb', line 33

def <<(diff_lcs_context_change)
  word_run_context_change = WordRunContextChange.new(diff_lcs_context_change)

  if empty?
    @word_run_context_changes << word_run_context_change
  else
    @word_run_context_changes << word_run_context_change unless last.merge!(word_run_context_change)
  end
end

#map(&block) ⇒ Object



42
43
44
# File 'lib/word_run_diff_lcs.rb', line 42

def map(&block)
  @word_run_context_changes.map(&block)
end