==( other )
click to toggle source
def ==( other )
other.respond_to?(:filename) and @filename == other.filename
end
aopen( &block )
click to toggle source
def aopen( &block )
File.open(@filename, 'a', &block)
end
copy_to( port )
click to toggle source
def copy_to( port )
if FilePort === port
copy_file @filename, port.filename
else
File.open(@filename) {|r|
port.wopen {|w|
while s = r.sysread(4096)
w.write << s
end
} }
end
end
cp( port )
click to toggle source
eql?( other )
click to toggle source
hash()
click to toggle source
def hash
@filename.hash
end
inspect()
click to toggle source
def inspect
"#<#{self.class}:#{@filename}>"
end
move_to( port )
click to toggle source
def move_to( port )
begin
File.link @filename, port.filename
rescue Errno::EXDEV
copy_to port
end
File.unlink @filename
end
mv( port )
click to toggle source
read_all()
click to toggle source
def read_all
ropen {|f|
return f.read
}
end
remove()
click to toggle source
def remove
File.unlink @filename
end
reproducible?()
click to toggle source
def reproducible?
true
end
ropen( &block )
click to toggle source
def ropen( &block )
File.open(@filename, &block)
end
size()
click to toggle source
def size
File.size @filename
end
wopen( &block )
click to toggle source
def wopen( &block )
File.open(@filename, 'w', &block)
end