Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit b00758a7 authored by Ary Borenszweig's avatar Ary Borenszweig
Browse files

Renamed FileUtils.compare_stream to cmp with IO restrictions

parent f6ee19ff
No related merge requests found
module FileUtils module FileUtils
extend self extend self
def cmp(filename1, filename2) def cmp(filename1 : String, filename2 : String)
return false unless File.size(filename1) == File.size(filename2) return false unless File.size(filename1) == File.size(filename2)
File.open(filename1, "rb") do |file1| File.open(filename1, "rb") do |file1|
File.open(filename2, "rb") do |file2| File.open(filename2, "rb") do |file2|
compare_stream(file1, file2) cmp(file1, file2)
end end
end end
end end
def compare_stream(stream1, stream2) def cmp(stream1 : IO, stream2 : IO)
buf1 :: UInt8[1024] buf1 :: UInt8[1024]
buf2 :: UInt8[1024] buf2 :: UInt8[1024]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment