lib/origen/utility/file_diff.rb in origen-0.60.7 vs lib/origen/utility/file_diff.rb in origen-0.60.8
- old
+ new
@@ -23,13 +23,15 @@
end
class OutputFile < Array
class Line < String
attr_accessor :type, :original_number
+
def initialize(type, input_file)
self.type = type
return unless input_file
+
replace(input_file.current_line)
self.original_number = input_file.pointer + 1
input_file.advance_pointer!
end
end
@@ -57,10 +59,11 @@
# To Generate a TXT file (diff.txt) showing the differences
# Origen::Utility::FileDiff::Formatter::Text.new(processor.process!, "#{Origen.root}/diff.txt").format
class Processor
attr_accessor :source, :target
attr_accessor :source_output, :target_output
+
def initialize(source_file_name, target_file_name)
self.source = InputFile.new
self.target = InputFile.new
self.source_output = OutputFile.new
self.target_output = OutputFile.new
@@ -123,9 +126,10 @@
end
module Formatter
class Base
attr_accessor :source_output, :target_output, :file
+
def initialize(processed_diff, output_file_name)
self.source_output = processed_diff.source_output
self.target_output = processed_diff.target_output
self.file = File.open(output_file_name, 'w')
end