From: "Decurnex Gorosito, Roberto Eduardo" Date: 2007-12-23T03:06:49+09:00 Subject: Re: no method error (because of unknown variable type) Sebastian Hungerecker wrote: > Haris Bogdanovic wrote: > >> I get an error message that eof method is undefined. >> I presume that this is because ruby does not know that the "file" variable >> is going to become a File.object. >> > > You assume you get the error message when the method is defined. This is not > true. The error is raised when the method is actually called (with a file > object as a parameter). At this point ruby already knows that file is a File > object (because that's what was passed into the method) - that's not the > problem. The problem is that File objects don't have an eof method. It's eof? > (with a question mark). > > > HTH, > Sebastian > I insist, is not a problem of eof or eof?, they are both defined. The problem is that he is calling eof for a IO open to write but not to read.