|
|
||
-------------------------------------------------------------- Class: IO 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. Many of the examples in this section use class File , the only standard subclass of IO . The two classes are closely associated. As used in this section, _portname_ may take any of the following forms. * A plain string represents a filename suitable for the underlying operating system. * 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. * A string equal to `` |- '' will create another Ruby instance as a subprocess. 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: "c:\gumby\ruby\test.rb" Our examples here will use the Unix-style forward slashes