--- !ruby/object:RI::ClassDescription attributes: [] class_methods: - !ruby/object:RI::MethodSummary name: for_fd - !ruby/object:RI::MethodSummary name: foreach - !ruby/object:RI::MethodSummary name: new - !ruby/object:RI::MethodSummary name: new - !ruby/object:RI::MethodSummary name: open - !ruby/object:RI::MethodSummary name: pipe - !ruby/object:RI::MethodSummary name: popen - !ruby/object:RI::MethodSummary name: read - !ruby/object:RI::MethodSummary name: readlines - !ruby/object:RI::MethodSummary name: select - !ruby/object:RI::MethodSummary name: sysopen comment: - !ruby/struct:SM::Flow::P body: Class IO is the basis for all input and output in Ruby. An I/O stream may be duplexed (that is, bidirectional), and so may use more than one native operating system stream. - !ruby/struct:SM::Flow::P body: Many of the examples in this section use class File, the only standard subclass of IO. The two classes are closely associated. - !ruby/struct:SM::Flow::P body: As used in this section, portname may take any of the following forms. - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "*" body: A plain string represents a filename suitable for the underlying operating system. - !ruby/struct:SM::Flow::LI label: "*" body: A string starting with ``|'' indicates a subprocess. The remainder of the string following the ``|'' is invoked as a process with appropriate input/output channels connected to it. - !ruby/struct:SM::Flow::LI label: "*" body: A string equal to ``|-'' will create another Ruby instance as a subprocess. type: :BULLET - !ruby/struct:SM::Flow::P body: "Ruby will convert pathnames between different operating system conventions if possible. For instance, on a Windows system the filename ``/gumby/ruby/test.rb'' will be opened as ``\\gumby\\ruby\\test.rb''. When specifying a Windows-style filename in a Ruby string, remember to escape the backslashes:" - !ruby/struct:SM::Flow::VERB body: " "c:\\gumby\\ruby\\test.rb"\n" - !ruby/struct:SM::Flow::P body: Our examples here will use the Unix-style forward slashes; File::SEPARATOR can be used to get the platform-specific separator character. - !ruby/struct:SM::Flow::P body: I/O ports may be opened in any one of several different modes, which are shown in this section as mode. The mode may either be a Fixnum or a String. If numeric, it should be one of the operating system specific constants (O_RDONLY, O_WRONLY, O_RDWR, O_APPEND and so on). See man open(2) for more information. - !ruby/struct:SM::Flow::P body: If the mode is given as a String, it must be one of the values listed in the following table. - !ruby/struct:SM::Flow::VERB body: " Mode | Meaning\n -----+--------------------------------------------------------\n "r" | Read-only, starts at beginning of file (default mode).\n -----+--------------------------------------------------------\n "r+" | Read-write, starts at beginning of file.\n -----+--------------------------------------------------------\n "w" | Write-only, truncates existing file\n | to zero length or creates a new file for writing.\n -----+--------------------------------------------------------\n "w+" | Read-write, truncates existing file to zero length\n | or creates a new file for reading and writing.\n -----+--------------------------------------------------------\n "a" | Write-only, starts at end of file if file exists,\n | otherwise creates a new file for writing.\n -----+--------------------------------------------------------\n "a+" | Read-write, starts at end of file if file exists,\n | otherwise creates a new file for reading and\n | writing.\n -----+--------------------------------------------------------\n "b" | (DOS/Windows only) Binary file mode (may appear with\n | any of the key letters listed above).\n" - !ruby/struct:SM::Flow::P body: The global constant ARGF (also accessible as $<) provides an IO-like stream which allows access to all files mentioned on the command line (or STDIN if no files are mentioned). ARGF provides the methods #path and #filename to access the name of the file currently being read. constants: - !ruby/object:RI::Constant comment: name: SEEK_SET value: INT2FIX(SEEK_SET) - !ruby/object:RI::Constant comment: name: SEEK_CUR value: INT2FIX(SEEK_CUR) - !ruby/object:RI::Constant comment: name: SEEK_END value: INT2FIX(SEEK_END) full_name: IO includes: - !ruby/object:RI::IncludedModule name: File::Constants - !ruby/object:RI::IncludedModule name: Enumerable instance_methods: - !ruby/object:RI::MethodSummary name: "<<" - !ruby/object:RI::MethodSummary name: binmode - !ruby/object:RI::MethodSummary name: block_scanf - !ruby/object:RI::MethodSummary name: bytes - !ruby/object:RI::MethodSummary name: chars - !ruby/object:RI::MethodSummary name: close - !ruby/object:RI::MethodSummary name: close_read - !ruby/object:RI::MethodSummary name: close_write - !ruby/object:RI::MethodSummary name: closed? - !ruby/object:RI::MethodSummary name: each - !ruby/object:RI::MethodSummary name: each_byte - !ruby/object:RI::MethodSummary name: each_char - !ruby/object:RI::MethodSummary name: each_line - !ruby/object:RI::MethodSummary name: eof - !ruby/object:RI::MethodSummary name: eof? - !ruby/object:RI::MethodSummary name: fcntl - !ruby/object:RI::MethodSummary name: fileno - !ruby/object:RI::MethodSummary name: flush - !ruby/object:RI::MethodSummary name: fsync - !ruby/object:RI::MethodSummary name: getbyte - !ruby/object:RI::MethodSummary name: getc - !ruby/object:RI::MethodSummary name: gets - !ruby/object:RI::MethodSummary name: inspect - !ruby/object:RI::MethodSummary name: ioctl - !ruby/object:RI::MethodSummary name: isatty - !ruby/object:RI::MethodSummary name: lineno - !ruby/object:RI::MethodSummary name: lineno= - !ruby/object:RI::MethodSummary name: lines - !ruby/object:RI::MethodSummary name: pid - !ruby/object:RI::MethodSummary name: pos - !ruby/object:RI::MethodSummary name: pos= - !ruby/object:RI::MethodSummary name: print - !ruby/object:RI::MethodSummary name: printf - !ruby/object:RI::MethodSummary name: putc - !ruby/object:RI::MethodSummary name: puts - !ruby/object:RI::MethodSummary name: read - !ruby/object:RI::MethodSummary name: read_nonblock - !ruby/object:RI::MethodSummary name: readbyte - !ruby/object:RI::MethodSummary name: readbytes - !ruby/object:RI::MethodSummary name: readchar - !ruby/object:RI::MethodSummary name: readline - !ruby/object:RI::MethodSummary name: readlines - !ruby/object:RI::MethodSummary name: readpartial - !ruby/object:RI::MethodSummary name: reopen - !ruby/object:RI::MethodSummary name: rewind - !ruby/object:RI::MethodSummary name: scanf - !ruby/object:RI::MethodSummary name: seek - !ruby/object:RI::MethodSummary name: soak_up_spaces - !ruby/object:RI::MethodSummary name: stat - !ruby/object:RI::MethodSummary name: sync - !ruby/object:RI::MethodSummary name: sync= - !ruby/object:RI::MethodSummary name: sysread - !ruby/object:RI::MethodSummary name: sysseek - !ruby/object:RI::MethodSummary name: syswrite - !ruby/object:RI::MethodSummary name: tell - !ruby/object:RI::MethodSummary name: to_i - !ruby/object:RI::MethodSummary name: to_io - !ruby/object:RI::MethodSummary name: tty? - !ruby/object:RI::MethodSummary name: ungetc - !ruby/object:RI::MethodSummary name: write - !ruby/object:RI::MethodSummary name: write_nonblock name: IO superclass: