celluloid / celluloid-io

UNMAINTAINED: See celluloid/celluloid#779 - Evented sockets for Celluloid actors
https://celluloid.io
MIT License
879 stars 93 forks source link

Add eof?/eof method as part of buffed IO method. #76

Closed unakatsuo closed 11 years ago

unakatsuo commented 11 years ago

IO#eof?/eof is a blocking method according to the reference manual. so they are added to adapt the standard.

http://www.ruby-doc.org/core-2.0/IO.html#method-i-eof

coveralls commented 11 years ago

Coverage Status

Coverage increased (+0%) when pulling 1f5dbaf10c1b3bcee39ca1ec01796330e3496973 on unakatsuo:eof-method into f041100de11c7d91419c4f85604f39ce45cacd27 on celluloid:master.

halorgium commented 11 years ago

@unakatsuo looks good to me. @tarcieri I'll leave the merge up to you.

Side note: should we be having shared examples for readable and writeable streams? There is a severe amount of duplication.

tarcieri commented 11 years ago

One minor nit, otherwise this looks great, thanks!

unakatsuo commented 11 years ago

I am going to take down the PR since original Stream#eof? seems to work perfectly by following MRI's behavior.

r,w = IO.pipe

w << 0x00
w.flush

puts "r.eof? == false:  " + (r.eof? == false).to_s
r.read(1) == 0x00
puts "r.eof? == false:  " + (r.eof? == false).to_s # .eof? blocks here.

this does not show second ""r.eof? == false: " line on ruby-2.0.0-p247.

halorgium commented 11 years ago

@unakatsuo ok, I will close this!