M
Mmcolli00 Mom
This is something that I have been working on using diff/lcs. I am
beginner.
With my code (at bottom) I am now outputing to output window values like
#<Diff::LCS::ContextChange:24252450 @action== positions=0,0
elements="\n","\n">....
I need the ability to write to file and include above data such as
@action== positions=0,0..etc. My code issue is that when I try to
transfer this to a text file..it only writes the following.
#<Diff::LCS::ContextChange:0x2e4215c>
#<Diff::LCS::ContextChange:0x2e42044>
#<Diff::LCS::ContextChange:0x2e41f2c>
#<Diff::LCS::ContextChange:0x2e41dec>
#<Diff::LCS::ContextChange:0x2e41d24>
#<Diff::LCS::ContextChange:0x2e41c0c>
#<Diff::LCS::ContextChange:0x2e41af4>
Here's code:
require 'rubygems'
require 'diff/lcs/array'
require 'rubygems'
require 'diff/lcs/array'
lines1 = lines2 = nil
File.open("xml1.txt") { |f| lines1 = f.readlines}
File.open("xml2.txt") { |f| lines2 = f.readlines }
diffs = Diff::LCS.diff(lines1, lines2)
sdiff = Diff::LCS.sdiff(lines1,lines2)
p sdiff = Diff::LCS.sdiff(lines1, lines2)
File.open('log.txt', 'w') do |f1|
f1.puts sdiff
f1.close
end
beginner.
With my code (at bottom) I am now outputing to output window values like
#<Diff::LCS::ContextChange:24252450 @action== positions=0,0
elements="\n","\n">....
I need the ability to write to file and include above data such as
@action== positions=0,0..etc. My code issue is that when I try to
transfer this to a text file..it only writes the following.
#<Diff::LCS::ContextChange:0x2e4215c>
#<Diff::LCS::ContextChange:0x2e42044>
#<Diff::LCS::ContextChange:0x2e41f2c>
#<Diff::LCS::ContextChange:0x2e41dec>
#<Diff::LCS::ContextChange:0x2e41d24>
#<Diff::LCS::ContextChange:0x2e41c0c>
#<Diff::LCS::ContextChange:0x2e41af4>
Here's code:
require 'rubygems'
require 'diff/lcs/array'
require 'rubygems'
require 'diff/lcs/array'
lines1 = lines2 = nil
File.open("xml1.txt") { |f| lines1 = f.readlines}
File.open("xml2.txt") { |f| lines2 = f.readlines }
diffs = Diff::LCS.diff(lines1, lines2)
sdiff = Diff::LCS.sdiff(lines1,lines2)
p sdiff = Diff::LCS.sdiff(lines1, lines2)
File.open('log.txt', 'w') do |f1|
f1.puts sdiff
f1.close
end