module FileUtils
Public Class Methods
Source
# File lib/logging/utils.rb, line 126 def concat( src, dest ) if File.exist?(dest) bufsize = File.stat(dest).blksize || 8192 buffer = String.new File.open(dest, 'a') { |d| File.open(src, 'r') { |r| while bytes = r.read(bufsize, buffer) d.syswrite bytes end } } else copy_file(src, dest) end end
Concatenate the contents of the src file to the end of the dest file. If the dest file does not exist, then the src file is copied to the dest file using copy_file
.
Private Instance Methods
Source
# File lib/logging/utils.rb, line 126 def concat( src, dest ) if File.exist?(dest) bufsize = File.stat(dest).blksize || 8192 buffer = String.new File.open(dest, 'a') { |d| File.open(src, 'r') { |r| while bytes = r.read(bufsize, buffer) d.syswrite bytes end } } else copy_file(src, dest) end end
Concatenate the contents of the src file to the end of the dest file. If the dest file does not exist, then the src file is copied to the dest file using copy_file
.