From: Jeremy Bopp Date: 2011-10-15T02:29:31+09:00 Subject: Re: What does this snippet mean? On 10/14/2011 12:15, Junayeed Ahnaf Nirjhor wrote: > Hello, > > > > Here’s a code snippet. What it actually does? > > > > def rewind(f) > > f.seek(0, IO::SEEK_SET) > > end The parameter f is assumed to be an IO object of some kind. Those objects include a method named seek that allows you to move the file pointer for the IO object around without performing read or write operations in order to do it. In case you don't know what a file pointer is, it is the location in a file's data from which read or write operations will start. When the file pointer is 0, it is at the beginning of the file's data. The rewind method above is setting the file pointer using an absolute position of 0. The IO::SEEK_SET argument to the seek method is what tells seek that the first argument of 0 is absolute. For more information, see the documentation for IO#seek: http://rdoc.info/stdlib/core/1.9.2/IO:seek -Jeremy