Class: Origen::Utility::FileDiff::Formatter::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/origen/utility/file_diff.rb

Instance Attribute Summary

Attributes inherited from Base

#file, #source_output, #target_output

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Origen::Utility::FileDiff::Formatter::Base

Instance Method Details

#formatObject


167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/origen/utility/file_diff.rb', line 167

def format
  pointer = 0
  while pointer < target_output.size
    size = 1
    type = source_output[pointer].type
    case type
    when :added
      added(pointer,    size = get_block_size(pointer, :added))
    when :deleted
      deleted(pointer,  size = get_block_size(pointer, :deleted))
    when :changed
      changed(pointer,  size = get_block_size(pointer, :changed))
    end
    file.puts unless type == :unchanged
    pointer += size
  end
end