Patrick McNally wrote:
 In many examples I have seen File.open used
> but when I refer to the official documentation
> (http://www.ruby-doc.org/core/) the 'open' method is not listed for the
> File class.
>> Paco


Hi,

open methed is a method defined in kernel module. Open a window prompt 
and try the following

C:\>ri open
More than one method matched your request. You can refine
your search by asking for information on one of:

     CSV::open, CSV::open_reader, CSV::open_writer, Dir::open,
     ...
     Iconv::open, IO::open, IO::popen, IO::sysopen, IO#reopen,
     Kernel#open, Kernel#open_uri_original_open,
     ...          Win32::EventLog::open_backup




Form the screen you can see kernel#open. This is where open comes from. 
BTW Ruby is case sensitive.

After that you can try the follows

C:\>ri Kernel.open
------------------------------------------------------------ Kernel#open
     open(path [, mode [, perm]] )                => io or nil
     open(path [, mode [, perm]] ) {|io| block }  => obj
------------------------------------------------------------------------
     Creates an +IO+ object connected to the given stream, file, or
     subprocess.

     ....
        open("testfile") do |f|
          print f.gets
        end

     _produces:_

        This is line one

     Open a subprocess and read its output:

        cmd = open("|date")
        print cmd.gets
        cmd.close

     _produces:_

        Wed Apr  9 08:56:31 CDT 2003

-- More  --

...




Li




-- 
Posted via http://www.ruby-forum.com/.