This method is deprecated or moved on the latest stable version.
The last existing version (v1_8_7_330) is shown here.
compare(from, to, verbose = false)
public
Returns true if and only if the contents of files from
and to are identical. If verbose is true,from <=> to is printed.
# File lib/ftools.rb, line 130
def compare(from, to, verbose = false)
$stderr.print from, " <=> ", to, "\n" if verbose
return false if stat(from).size != stat(to).size
from = open(from, "rb")
to = open(to, "rb")
ret = false
fr = tr = ''
begin
while fr == tr
fr = from.read(BUFSIZE)
if fr
tr = to.read(fr.size)
else
ret = to.read(BUFSIZE)
ret = !ret || ret.length == 0
break
end
end
rescue
ret = false
ensure
to.close
from.close
end
ret
end