What is the equivalent of Ruby IO.eof?

Thanks.

Crystal IO don’t have eof marker or method. So any read operation returning a count of zero (0) is considered as EOF.

1 Like

Although Crystal embraces some Ruby stuff, it is not a derivative of Ruby. It may not be necessary to expect it to always have equivalents to Ruby. I’m curious if Crystal’s way doesn’t solve the problem?

I’m curious if Crystal’s way doesn’t solve the problem?

I am trying porting a quite complicated gem into Crystal, so, for those exists feature, i have to find an equivalent usage.

Related:

You need to find an equivalent way to implement the features of the gem in Crystal. In some cases it’s not going to be as simple as copy the Ruby code over and add types. I’m sure there’s a way to implement the core feature you’re wanting in Crystal, even if the underlying implementation is different from the Ruby version.

I found this, based on your’s anwser.