rio 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -0
- data/ChangeLog +755 -0
- data/README +65 -0
- data/RUNME.1st.rb +75 -0
- data/Rakefile +312 -0
- data/VERSION +1 -0
- data/doc/README_MSWIN32.txt +39 -0
- data/doc/RELEASE_NOTES +130 -0
- data/doc/generators/template/html/rio.rb +895 -0
- data/doc/rdoc/classes/Kernel.html +181 -0
- data/doc/rdoc/classes/Kernel.src/M000183.html +18 -0
- data/doc/rdoc/classes/RIO.html +508 -0
- data/doc/rdoc/classes/RIO.src/M000001.html +18 -0
- data/doc/rdoc/classes/RIO.src/M000002.html +18 -0
- data/doc/rdoc/classes/RIO.src/M000003.html +18 -0
- data/doc/rdoc/classes/RIO/Doc.html +138 -0
- data/doc/rdoc/classes/RIO/Doc/HOWTO.html +1031 -0
- data/doc/rdoc/classes/RIO/Doc/INTRO.html +1116 -0
- data/doc/rdoc/classes/RIO/Doc/MISC.html +443 -0
- data/doc/rdoc/classes/RIO/Doc/SYNOPSIS.html +325 -0
- data/doc/rdoc/classes/RIO/Rio.html +6333 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000004.html +18 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000005.html +20 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000006.html +27 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000007.html +27 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000008.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000009.html +18 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000010.html +20 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000011.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000012.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000013.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000014.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000015.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000016.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000017.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000018.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000019.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000020.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000021.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000022.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000023.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000024.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000025.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000026.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000027.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000028.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000029.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000030.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000031.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000032.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000033.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000034.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000035.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000036.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000037.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000038.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000039.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000040.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000041.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000042.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000043.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000044.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000045.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000046.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000047.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000048.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000049.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000050.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000051.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000052.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000053.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000054.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000055.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000056.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000057.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000058.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000059.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000060.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000061.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000062.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000063.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000064.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000065.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000066.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000067.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000068.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000069.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000070.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000071.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000072.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000073.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000074.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000075.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000076.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000077.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000078.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000079.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000080.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000081.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000082.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000083.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000084.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000085.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000086.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000087.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000088.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000089.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000090.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000091.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000092.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000093.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000094.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000095.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000096.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000097.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000098.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000099.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000100.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000101.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000102.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000103.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000104.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000105.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000106.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000107.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000108.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000109.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000110.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000111.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000112.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000113.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000114.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000115.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000116.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000117.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000118.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000119.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000120.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000121.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000122.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000123.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000124.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000125.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000126.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000127.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000128.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000129.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000130.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000131.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000132.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000133.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000134.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000135.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000136.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000137.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000138.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000139.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000140.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000141.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000142.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000143.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000144.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000145.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000146.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000147.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000148.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000149.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000150.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000151.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000152.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000153.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000154.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000155.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000156.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000157.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000158.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000159.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000160.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000161.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000162.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000163.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000164.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000165.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000166.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000167.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000168.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000169.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000170.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000171.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000172.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000173.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000174.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000175.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000176.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000177.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000178.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000179.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000180.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000181.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000182.html +16 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/README.html +215 -0
- data/doc/rdoc/files/lib/rio/constructor_rb.html +142 -0
- data/doc/rdoc/files/lib/rio/doc/HOWTO_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/doc/INTRO_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/doc/MISC_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/doc/SYNOPSIS_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/basic_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/dir_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/file_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/fileordir_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/grande_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/internal_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/methods_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/path_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/stream_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/test_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/kernel_rb.html +142 -0
- data/doc/rdoc/files/lib/rio_rb.html +153 -0
- data/doc/rdoc/fr_class_index.html +34 -0
- data/doc/rdoc/fr_file_index.html +44 -0
- data/doc/rdoc/fr_method_index.html +210 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +384 -0
- data/doc/rfc1738.txt +1403 -0
- data/doc/rfc959.txt +3933 -0
- data/ex/colx.rb +6 -0
- data/ex/findinruby +19 -0
- data/ex/findruby +11 -0
- data/ex/prompt.rb +25 -0
- data/ex/rgb.txt.gz +0 -0
- data/ex/riocat +35 -0
- data/ex/riogunzip +31 -0
- data/ex/riogzip +24 -0
- data/ex/tolf +11 -0
- data/lib/rio.rb +163 -0
- data/lib/rio/abstract_method.rb +57 -0
- data/lib/rio/argv.rb +57 -0
- data/lib/rio/arrayio.rb +199 -0
- data/lib/rio/arycopy.rb +44 -0
- data/lib/rio/assert.rb +115 -0
- data/lib/rio/base.rb +59 -0
- data/lib/rio/constructor.rb +183 -0
- data/lib/rio/context.rb +117 -0
- data/lib/rio/context/chomp.rb +53 -0
- data/lib/rio/context/closeoneof.rb +50 -0
- data/lib/rio/context/cxx.rb +67 -0
- data/lib/rio/context/dir.rb +92 -0
- data/lib/rio/context/gzip.rb +51 -0
- data/lib/rio/context/methods.rb +196 -0
- data/lib/rio/context/stream.rb +170 -0
- data/lib/rio/cp.rb +305 -0
- data/lib/rio/cxdir.rb +79 -0
- data/lib/rio/dir.rb +145 -0
- data/lib/rio/doc.rb +45 -0
- data/lib/rio/doc/HOWTO.rb +691 -0
- data/lib/rio/doc/INTRO.rb +579 -0
- data/lib/rio/doc/MISC.rb +257 -0
- data/lib/rio/doc/SYNOPSIS.rb +170 -0
- data/lib/rio/entrysel.rb +162 -0
- data/lib/rio/exception.rb +42 -0
- data/lib/rio/exception/copy.rb +98 -0
- data/lib/rio/exception/open.rb +62 -0
- data/lib/rio/exception/state.rb +74 -0
- data/lib/rio/ext.rb +62 -0
- data/lib/rio/ext/csv.rb +261 -0
- data/lib/rio/factory.rb +236 -0
- data/lib/rio/file.rb +77 -0
- data/lib/rio/filter/chomp.rb +61 -0
- data/lib/rio/filter/closeoneof.rb +103 -0
- data/lib/rio/filter/gzip.rb +58 -0
- data/lib/rio/ftp.rb +275 -0
- data/lib/rio/ftp/conn.rb +167 -0
- data/lib/rio/ftp/ioh.rb +88 -0
- data/lib/rio/grande.rb +126 -0
- data/lib/rio/handle.rb +101 -0
- data/lib/rio/if.rb +53 -0
- data/lib/rio/if/basic.rb +64 -0
- data/lib/rio/if/dir.rb +362 -0
- data/lib/rio/if/file.rb +57 -0
- data/lib/rio/if/fileordir.rb +247 -0
- data/lib/rio/if/grande.rb +510 -0
- data/lib/rio/if/internal.rb +53 -0
- data/lib/rio/if/methods.rb +612 -0
- data/lib/rio/if/path.rb +413 -0
- data/lib/rio/if/stream.rb +599 -0
- data/lib/rio/if/test.rb +219 -0
- data/lib/rio/impl/path.rb +82 -0
- data/lib/rio/ioh.rb +137 -0
- data/lib/rio/iomode.rb +96 -0
- data/lib/rio/kernel.rb +47 -0
- data/lib/rio/local.rb +63 -0
- data/lib/rio/match.rb +51 -0
- data/lib/rio/matchrecord.rb +254 -0
- data/lib/rio/open3.rb +69 -0
- data/lib/rio/ops/create.rb +78 -0
- data/lib/rio/ops/dir.rb +302 -0
- data/lib/rio/ops/either.rb +117 -0
- data/lib/rio/ops/file.rb +94 -0
- data/lib/rio/ops/path.rb +292 -0
- data/lib/rio/ops/stream.rb +84 -0
- data/lib/rio/ops/stream/input.rb +237 -0
- data/lib/rio/ops/stream/output.rb +96 -0
- data/lib/rio/ops/stream/read.rb +84 -0
- data/lib/rio/ops/stream/write.rb +58 -0
- data/lib/rio/ops/symlink.rb +70 -0
- data/lib/rio/path.rb +117 -0
- data/lib/rio/path/reset.rb +70 -0
- data/lib/rio/record.rb +59 -0
- data/lib/rio/rectype.rb +86 -0
- data/lib/rio/rl/base.rb +147 -0
- data/lib/rio/rl/builder.rb +166 -0
- data/lib/rio/rl/ioi.rb +66 -0
- data/lib/rio/rl/path.rb +141 -0
- data/lib/rio/rl/uri.rb +118 -0
- data/lib/rio/scheme/aryio.rb +89 -0
- data/lib/rio/scheme/cmdio.rb +74 -0
- data/lib/rio/scheme/fd.rb +65 -0
- data/lib/rio/scheme/ftp.rb +73 -0
- data/lib/rio/scheme/http.rb +81 -0
- data/lib/rio/scheme/path.rb +100 -0
- data/lib/rio/scheme/stderr.rb +56 -0
- data/lib/rio/scheme/stdio.rb +71 -0
- data/lib/rio/scheme/strio.rb +82 -0
- data/lib/rio/scheme/sysio.rb +61 -0
- data/lib/rio/scheme/tcp.rb +74 -0
- data/lib/rio/scheme/tempfile.rb +104 -0
- data/lib/rio/state.rb +209 -0
- data/lib/rio/state/error.rb +73 -0
- data/lib/rio/stream.rb +181 -0
- data/lib/rio/stream/base.rb +50 -0
- data/lib/rio/stream/duplex.rb +76 -0
- data/lib/rio/stream/open.rb +203 -0
- data/lib/rio/symantics.rb +46 -0
- data/lib/rio/to_rio.rb +57 -0
- data/lib/rio/uri/file.rb +145 -0
- data/lib/rio/version.rb +52 -0
- data/setup.rb +1331 -0
- data/test/1.rb +14 -0
- data/test/mswin32.rb +28 -0
- data/test/once.rb +7 -0
- data/test/runtests.rb +12 -0
- data/test/runtests_gem.rb +15 -0
- data/test/tc/abs.rb +349 -0
- data/test/tc/all.rb +42 -0
- data/test/tc/cd1.rb +116 -0
- data/test/tc/clearsel.rb +69 -0
- data/test/tc/closeoncopy.rb +91 -0
- data/test/tc/closeoneof.rb +194 -0
- data/test/tc/copy-from.rb +183 -0
- data/test/tc/copy-to.rb +94 -0
- data/test/tc/copy.rb +72 -0
- data/test/tc/copyarray.rb +191 -0
- data/test/tc/copydest.rb +50 -0
- data/test/tc/copydir.rb +192 -0
- data/test/tc/copydirlines.rb +124 -0
- data/test/tc/copylines.rb +40 -0
- data/test/tc/copynonex.rb +121 -0
- data/test/tc/create.rb +104 -0
- data/test/tc/csv.rb +229 -0
- data/test/tc/dir.rb +79 -0
- data/test/tc/dirautoclose.rb +70 -0
- data/test/tc/dirent.rb +180 -0
- data/test/tc/dirss.rb +84 -0
- data/test/tc/each.rb +111 -0
- data/test/tc/each_break.rb +241 -0
- data/test/tc/edf.rb +82 -0
- data/test/tc/entary.rb +230 -0
- data/test/tc/eq.rb +101 -0
- data/test/tc/expand_path.rb +94 -0
- data/test/tc/ext.rb +115 -0
- data/test/tc/fileno.rb +95 -0
- data/test/tc/getrec.rb +140 -0
- data/test/tc/lineno.rb +197 -0
- data/test/tc/lines.rb +66 -0
- data/test/tc/methods.rb +185 -0
- data/test/tc/misc.rb +473 -0
- data/test/tc/nolines.rb +205 -0
- data/test/tc/noqae.rb +873 -0
- data/test/tc/once.rb +6 -0
- data/test/tc/overload.rb +137 -0
- data/test/tc/pa.rb +159 -0
- data/test/tc/pathop.rb +63 -0
- data/test/tc/paths.rb +147 -0
- data/test/tc/qae.rb +494 -0
- data/test/tc/qae_riovar.rb +500 -0
- data/test/tc/records.rb +69 -0
- data/test/tc/rename.rb +224 -0
- data/test/tc/rename_assign.rb +48 -0
- data/test/tc/sub.rb +49 -0
- data/test/tc/symlink.rb +177 -0
- data/test/tc/symlink0.rb +298 -0
- data/test/tc/symlink1.rb +115 -0
- data/test/tc/testcase.rb +152 -0
- metadata +461 -0
data/lib/rio/if/path.rb
ADDED
@@ -0,0 +1,413 @@
|
|
1
|
+
#--
|
2
|
+
# ===============================================================================
|
3
|
+
# Copyright (c) 2005, Christopher Kleckner
|
4
|
+
# All rights reserved
|
5
|
+
#
|
6
|
+
# This file is part of the Rio library for ruby.
|
7
|
+
#
|
8
|
+
# Rio is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# Rio is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with Rio; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
# ===============================================================================
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
# To create the documentation for Rio run the command
|
25
|
+
# rake rdoc
|
26
|
+
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
|
+
#
|
28
|
+
# Suggested Reading
|
29
|
+
# * RIO::Doc::SYNOPSIS
|
30
|
+
# * RIO::Doc::INTRO
|
31
|
+
# * RIO::Doc::HOWTO
|
32
|
+
# * RIO::Rio
|
33
|
+
#
|
34
|
+
# <b>Rio is pre-alpha software.
|
35
|
+
# The documented interface and behavior is subject to change without notice.</b>
|
36
|
+
|
37
|
+
|
38
|
+
module RIO
|
39
|
+
class Rio
|
40
|
+
|
41
|
+
# Returns the path for the Rio, which is defined differently for different types of Rios.
|
42
|
+
#
|
43
|
+
# For Rios representing paths on the underlying file system this proxies URI::FILE#path or URI::Generic#path
|
44
|
+
# depending on whether the Rio is absolute or not. Note that this is *not* the same as Rio#fspath, but rather
|
45
|
+
# a URL path as defined in RFC 1738.
|
46
|
+
#
|
47
|
+
# For HTTP Rios this proxies this proxies URI::HTTP#path
|
48
|
+
#
|
49
|
+
# For special Rios such as stdin: and stderr: this returns the special symbol used to create the Rio
|
50
|
+
#
|
51
|
+
# Specifically:
|
52
|
+
# '-' => stdio:
|
53
|
+
# '=' => stderr:
|
54
|
+
# '?' => tempfile:
|
55
|
+
# '$' => stringio:
|
56
|
+
# '_' => sysio:
|
57
|
+
#
|
58
|
+
# This list of possible paths may not be comprehensive as new types of Rios are added, however,
|
59
|
+
# A Rio should always return a path when the underlying object has a concept of a path and something
|
60
|
+
# else that is reasonable for Rios that have no such concept
|
61
|
+
#
|
62
|
+
def path(*args) target.path(*args) end
|
63
|
+
|
64
|
+
def to_url() target.to_url end
|
65
|
+
def to_uri() target.to_uri end
|
66
|
+
|
67
|
+
# Returns the path for the Rio on the underlying file system
|
68
|
+
# Returns nil if the Rio is not on the filesystem (i.e. stdin: or http: Rios)
|
69
|
+
def fspath(*args) target.fspath(*args) end
|
70
|
+
|
71
|
+
# Proxy for File#expand_path
|
72
|
+
#
|
73
|
+
# Converts a pathname to an absolute pathname.
|
74
|
+
# Relative paths are referenced from the current working directory of the process
|
75
|
+
# unless dir_string is given, in which case it will be used as the starting point.
|
76
|
+
# The given pathname may start with a ``~��, which expands to the process owner�s
|
77
|
+
# home directory (the environment variable HOME must be set correctly).
|
78
|
+
# ``~user�� expands to the named user�s home directory.
|
79
|
+
#
|
80
|
+
# Returns a Rio representing the returned path
|
81
|
+
#
|
82
|
+
#
|
83
|
+
def expand_path(*args) target.expand_path(*args) end
|
84
|
+
|
85
|
+
|
86
|
+
# Returns a new rio with a path equal to the absolute path of this rio
|
87
|
+
#
|
88
|
+
# rio('/tmp').chdir
|
89
|
+
# rio('afile').abs # => rio('/tmp/afile')
|
90
|
+
def abs(*args) target.abs(*args) end
|
91
|
+
|
92
|
+
|
93
|
+
# Returns a new rio with a path equal to the relative path from _other_
|
94
|
+
# rio('/tmp/afile').rel('/tmp') #=> rio('afile')
|
95
|
+
# rio('zippy/afile').rel('zippy') #=> rio('afile')
|
96
|
+
#
|
97
|
+
def rel(other) target.rel(other) end
|
98
|
+
|
99
|
+
|
100
|
+
# Sets the string that the Rio considers an extension. The value will be used by
|
101
|
+
# subsequent calls to Rio#basename. If called with no arguments resets its value
|
102
|
+
# to the value returned by File#extname. Returns the Rio
|
103
|
+
# ario = rio('afile.txt')
|
104
|
+
# ario.ext('.txt').basename #=> rio('afile')
|
105
|
+
# ario.ext('.zip').basename #=> rio('afile.txt')
|
106
|
+
# ario.ext.basename #=> rio('afile')
|
107
|
+
# ario.ext('').basename #=> rio('afile.txt')
|
108
|
+
# See also Rio#ext,Rio#ext?,Rio#filename,
|
109
|
+
#
|
110
|
+
def ext(arg=nil) target.ext(arg); self end
|
111
|
+
|
112
|
+
|
113
|
+
# Identical to Rio#ext('')
|
114
|
+
# See Rio#ext
|
115
|
+
# ario.basename #=> rio('afile')
|
116
|
+
# ario.noext.basename #=> rio('afile.txt')
|
117
|
+
#
|
118
|
+
def noext() target.noext(); self end
|
119
|
+
|
120
|
+
|
121
|
+
# Returns the value of the Rio's 'ext' variable
|
122
|
+
# This defaults to the value returned by Rio#extname and may be set by either calling Rio#ext
|
123
|
+
# or by passing an argument Rio#basename
|
124
|
+
# See also Rio#basename, Rio#ext, Rio#extname, Rio#noext
|
125
|
+
#
|
126
|
+
# ario = rio('afile.txt')
|
127
|
+
# ario.ext? #=> '.txt'
|
128
|
+
# ario.ext('.txt').basename #=> rio('afile')
|
129
|
+
# ario.ext? #=> '.txt'
|
130
|
+
# ario.ext('.zip').basename #=> rio('afile.txt')
|
131
|
+
# ario.ext? #=> '.zip'
|
132
|
+
# ario.basename('.tar') #=> rio('afile.txt')
|
133
|
+
# ario.ext? #=> '.tar'
|
134
|
+
# ario.ext.basename #=> rio('afile')
|
135
|
+
# ario.ext? #=> '.txt'
|
136
|
+
# ario.noext.basename #=> rio('afile.txt')
|
137
|
+
# ario.ext? #=> ''
|
138
|
+
#
|
139
|
+
def ext?() target.ext?() end
|
140
|
+
|
141
|
+
|
142
|
+
# Similar to File#basename
|
143
|
+
#
|
144
|
+
# Returns a Rio whose path is that returned by File#basename when passed the path
|
145
|
+
# of a rio and the value returned by File#extname. This differs from the behaviour
|
146
|
+
# of File#basename.
|
147
|
+
# File.basename('afile.txt') #=> 'afile.txt'
|
148
|
+
# File.basename('afile.txt',File.extname('afile.txt')) #=> 'afile'
|
149
|
+
# rio('afile.txt').basename #=> rio('afile')
|
150
|
+
# rio('afile.txt').basename('.txt') #=> same thing
|
151
|
+
# rio('afile.txt').ext('.txt').basename #=> same thing
|
152
|
+
# See also Rio#ext,Rio#ext?,Rio#filename,
|
153
|
+
def basename(*args) target.basename(*args) end
|
154
|
+
|
155
|
+
|
156
|
+
# Calls File#dirname
|
157
|
+
#
|
158
|
+
# Returns a new Rio referencing the directory portion of a Rio.
|
159
|
+
# rio('/tmp/zippy.txt').dirname #=> rio('/tmp')
|
160
|
+
#
|
161
|
+
def dirname(*args) target.dirname(*args) end
|
162
|
+
|
163
|
+
|
164
|
+
# Calls File#extname
|
165
|
+
#
|
166
|
+
# Returns a String containing the path's extension
|
167
|
+
# rio('/tmp/zippy.txt').extname #=> rio('.txt')
|
168
|
+
#
|
169
|
+
def extname(*args) target.extname(*args) end
|
170
|
+
|
171
|
+
|
172
|
+
# Returns a new Rio with all path information stripped away. This is similar to
|
173
|
+
# Rio#basename, except that it always includes an extension if one exists
|
174
|
+
#
|
175
|
+
# rio('apath/afile.txt').filename #=> rio('afile.txt')
|
176
|
+
#
|
177
|
+
def filename() target.filename() end
|
178
|
+
|
179
|
+
|
180
|
+
# Replace the part of the path returned by Rio#extname. If in +rename+
|
181
|
+
# mode, also renames the referenced filesystem object.
|
182
|
+
#
|
183
|
+
# Returns the extension
|
184
|
+
#
|
185
|
+
# ario = rio('dirA/dirB/afile.rb')
|
186
|
+
# ario.extname = '.txt' # rio('dirC/bfile.txt')
|
187
|
+
#
|
188
|
+
# rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
189
|
+
#
|
190
|
+
# See Rio#extname, Rio#rename
|
191
|
+
#
|
192
|
+
def extname=(arg) target.extname = arg end
|
193
|
+
|
194
|
+
|
195
|
+
# Replace the part of the path returned by Rio#basename. If in +rename+
|
196
|
+
# mode, also renames the referenced filesystem object.
|
197
|
+
#
|
198
|
+
# Returns the new value of +basename+
|
199
|
+
#
|
200
|
+
# ario = rio('dirA/dirB/afile.rb')
|
201
|
+
# ario.dirname = 'dirC' # rio('dirC/afile.rb')
|
202
|
+
# ario.basename = 'bfile' # rio('dirC/bfile.rb')
|
203
|
+
# ario.extname = '.txt' # rio('dirC/bfile.txt')
|
204
|
+
# ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
|
205
|
+
#
|
206
|
+
# rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
|
207
|
+
# rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
|
208
|
+
# rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
209
|
+
# rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
|
210
|
+
#
|
211
|
+
# See Rio#basename, Rio#rename
|
212
|
+
#
|
213
|
+
def basename=(arg) target.basename = arg end
|
214
|
+
|
215
|
+
|
216
|
+
# Replace the part of the path returned by Rio#dirname. If in +rename+
|
217
|
+
# mode, also renames the referenced filesystem object.
|
218
|
+
#
|
219
|
+
# Returns the new value of +dirname+
|
220
|
+
#
|
221
|
+
# ario = rio('dirA/dirB/afile.rb')
|
222
|
+
# ario.dirname = 'dirC' # rio('dirC/afile.rb')
|
223
|
+
# ario.basename = 'bfile' # rio('dirC/bfile.rb')
|
224
|
+
# ario.extname = '.txt' # rio('dirC/bfile.txt')
|
225
|
+
# ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
|
226
|
+
#
|
227
|
+
# rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
|
228
|
+
# rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
|
229
|
+
# rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
230
|
+
# rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
|
231
|
+
#
|
232
|
+
# See Rio#dirname, Rio#rename
|
233
|
+
#
|
234
|
+
def dirname=(arg) target.dirname = arg end
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
# Replace the part of the path returned by Rio#filename. If in +rename+
|
239
|
+
# mode, also renames the referenced filesystem object.
|
240
|
+
#
|
241
|
+
# Returns the new value of +filename+
|
242
|
+
#
|
243
|
+
# ario = rio('dirA/dirB/afile.rb')
|
244
|
+
# ario.dirname = 'dirC' # rio('dirC/afile.rb')
|
245
|
+
# ario.basename = 'bfile' # rio('dirC/bfile.rb')
|
246
|
+
# ario.extname = '.txt' # rio('dirC/bfile.txt')
|
247
|
+
# ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
|
248
|
+
#
|
249
|
+
# rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
|
250
|
+
# rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
|
251
|
+
# rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
252
|
+
# rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
|
253
|
+
#
|
254
|
+
# See Rio#filename, Rio#rename
|
255
|
+
#
|
256
|
+
def filename=(arg) target.filename = arg end
|
257
|
+
|
258
|
+
|
259
|
+
# Creates new Rio by adding args as additional directory components like File#join.
|
260
|
+
#
|
261
|
+
# ario = rio('adir')
|
262
|
+
# brio = rio('b')
|
263
|
+
# crio = ario.join(brio) #=> rio('adir/b')
|
264
|
+
#
|
265
|
+
# ario = rio('adir')
|
266
|
+
# ario.join('b','c','d') #=> rio('ario/b/c/d')
|
267
|
+
#
|
268
|
+
# See also Rio#/
|
269
|
+
def join(*args) target.join(*args) end
|
270
|
+
|
271
|
+
|
272
|
+
# Creates an array of Rios, one for each path element.
|
273
|
+
# (Note that this behavior differs from File#split.)
|
274
|
+
#
|
275
|
+
# rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
|
276
|
+
#
|
277
|
+
# The array returned is extended with a +to_rio+ method,
|
278
|
+
# which will put the parts back together again.
|
279
|
+
#
|
280
|
+
# ary = rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
|
281
|
+
# ary.to_rio #=> rio('a/b/c')
|
282
|
+
#
|
283
|
+
# ary = rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
|
284
|
+
# ary[1] = rio('d')
|
285
|
+
# ary.to_rio #=> rio('a/d/c')
|
286
|
+
#
|
287
|
+
# See also Rio#join, Rio#/
|
288
|
+
def split() target.split() end
|
289
|
+
|
290
|
+
|
291
|
+
# Subdirectory operator.
|
292
|
+
#
|
293
|
+
# Effectively the same as Rio#join(arg)
|
294
|
+
#
|
295
|
+
# a = rio('a')
|
296
|
+
# b = rio('b')
|
297
|
+
# c = a/b #=> rio('a/b')
|
298
|
+
#
|
299
|
+
# ario = rio('adir')
|
300
|
+
# ario/'afile.rb' #=> rio('ario/afile.rb')
|
301
|
+
# ario/'b'/'c'/'d' #=> rio('ario/b/c/d')
|
302
|
+
#
|
303
|
+
# ario = rio('adir')
|
304
|
+
# ario /= 'afile.rb' #=> rio('ario/afile.rb')
|
305
|
+
#
|
306
|
+
def /(arg) target / arg end
|
307
|
+
|
308
|
+
|
309
|
+
# Create a Rio referencing Rio#to_s + arg.to_s
|
310
|
+
#
|
311
|
+
def +(arg) target + arg end
|
312
|
+
|
313
|
+
# Create a new Rio referencing the result of applying String#sub to the value returned by
|
314
|
+
# Rio#to_s
|
315
|
+
def sub(re,string) target.sub(re,string) end
|
316
|
+
|
317
|
+
# Create a new Rio referencing the result of applying String#gsub to the value returned by
|
318
|
+
# Rio#to_s
|
319
|
+
def gsub(re,string) target.gsub(re,string) end
|
320
|
+
|
321
|
+
|
322
|
+
# Rio#catpath!
|
323
|
+
#
|
324
|
+
#
|
325
|
+
#def catpath!(*args) target.catpath!(*args); self end
|
326
|
+
|
327
|
+
|
328
|
+
# Rio#catpath
|
329
|
+
#
|
330
|
+
#
|
331
|
+
#def catpath(*args) target.catpath(*args) end
|
332
|
+
|
333
|
+
|
334
|
+
# Changes a Rio inplace by adding args as additional directory components like Rio#join,
|
335
|
+
#
|
336
|
+
def join!(*args) target.join!(*args); self end
|
337
|
+
|
338
|
+
# Rio#rootpath
|
339
|
+
#
|
340
|
+
#
|
341
|
+
def rootpath(*args) target.rootpath(*args) end
|
342
|
+
|
343
|
+
|
344
|
+
# Rio#root
|
345
|
+
#
|
346
|
+
#
|
347
|
+
##def root(*args,&block) target.root(*args,&block) end
|
348
|
+
|
349
|
+
|
350
|
+
# Rio#cwd
|
351
|
+
#
|
352
|
+
#
|
353
|
+
##def cwd(*args,&block) target.cwd(*args,&block) end
|
354
|
+
|
355
|
+
|
356
|
+
# Rio#getwd
|
357
|
+
#
|
358
|
+
#
|
359
|
+
##def getwd(*args,&block) target.getwd(*args,&block) end
|
360
|
+
|
361
|
+
|
362
|
+
# Rio#base
|
363
|
+
#
|
364
|
+
#
|
365
|
+
def base() target.base() end
|
366
|
+
|
367
|
+
|
368
|
+
# Returns the scheme for Rio's URI like URI#scheme where the Rio is represented
|
369
|
+
# by a standard URI. For Rios that are not represented by standard URIs one of
|
370
|
+
# Rio's non-standard schemes's is returned.
|
371
|
+
#
|
372
|
+
# rio('http://ruby-doc.org/') #=> 'http'
|
373
|
+
#
|
374
|
+
def scheme(*args) target.scheme(*args) end
|
375
|
+
|
376
|
+
# Proxy for URI#host
|
377
|
+
#
|
378
|
+
# rio('http://ruby-doc.org/') #=> 'ruby-doc'
|
379
|
+
#
|
380
|
+
def host(*args) target.host(*args) end
|
381
|
+
|
382
|
+
# Proxy for URI#opaque
|
383
|
+
#
|
384
|
+
def opaque(*args) target.opaque(*args) end
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
# Proxy for URI#merge
|
389
|
+
#
|
390
|
+
# Merges to Rios. URI#merge does not document exactly what merging to URIs means. This appears to
|
391
|
+
# join the the paths with like <tt>other + path</tt>. See URI#merge for less information.
|
392
|
+
#
|
393
|
+
#
|
394
|
+
def merge(other) target.merge(other) end
|
395
|
+
|
396
|
+
|
397
|
+
# Proxy for URI#route_from
|
398
|
+
#
|
399
|
+
# Returns a new rio representing the path to this Rio from the perspective of _other_.
|
400
|
+
# URI#route_from requires that absolute URIs be used. Rio#route_from does not.
|
401
|
+
#
|
402
|
+
def route_from(other) target.route_from(other) end
|
403
|
+
|
404
|
+
# Proxy for URI#route_to
|
405
|
+
#
|
406
|
+
# Returns a new rio representing the path to _other_ from the perspective of this Rio.
|
407
|
+
# URI#route_to requires that absolute URIs be used. Rio#route_to does not.
|
408
|
+
#
|
409
|
+
def route_to(other) target.route_to(other) end
|
410
|
+
|
411
|
+
|
412
|
+
end
|
413
|
+
end
|
@@ -0,0 +1,599 @@
|
|
1
|
+
#--
|
2
|
+
# ===============================================================================
|
3
|
+
# Copyright (c) 2005, Christopher Kleckner
|
4
|
+
# All rights reserved
|
5
|
+
#
|
6
|
+
# This file is part of the Rio library for ruby.
|
7
|
+
#
|
8
|
+
# Rio is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# Rio is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with Rio; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
# ===============================================================================
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
# To create the documentation for Rio run the command
|
25
|
+
# rake rdoc
|
26
|
+
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
|
27
|
+
#
|
28
|
+
# Suggested Reading
|
29
|
+
# * RIO::Doc::SYNOPSIS
|
30
|
+
# * RIO::Doc::INTRO
|
31
|
+
# * RIO::Doc::HOWTO
|
32
|
+
# * RIO::Rio
|
33
|
+
#
|
34
|
+
# <b>Rio is pre-alpha software.
|
35
|
+
# The documented interface and behavior is subject to change without notice.</b>
|
36
|
+
|
37
|
+
|
38
|
+
module RIO
|
39
|
+
class Rio
|
40
|
+
# Calls IO#gets
|
41
|
+
#
|
42
|
+
# Reads the next line from the Rio; lines are separated by sep_string.
|
43
|
+
# A separator of nil reads the entire contents, and a zero-length separator reads
|
44
|
+
# the input a paragraph at a time (two successive newlines in the input separate paragraphs).
|
45
|
+
#
|
46
|
+
# Returns nil if called at end of file.
|
47
|
+
#
|
48
|
+
# astring = rio('afile.txt').gets # read the first line of afile.txt into astring
|
49
|
+
#
|
50
|
+
def gets(sep_string=$/) target.gets(sep_string) end
|
51
|
+
|
52
|
+
# Slurps the contents of the rio into a string. See also Rio#contents
|
53
|
+
#
|
54
|
+
# astring = rio('afile.txt').slurp # slurp the entire contents of afile.txt into astring
|
55
|
+
#
|
56
|
+
# Alpha Note: Considering removing Rio#contents and Rio#slurp in favor of +to_string+. Is
|
57
|
+
# this the Ruby way? Is it too confusing with a +to_s+ and +to_str+ already? Is it a good idea?
|
58
|
+
def slurp() target.slurp() end
|
59
|
+
|
60
|
+
# Returns the contents of the rio as a string. See also Rio#slurp
|
61
|
+
#
|
62
|
+
# astring = rio('afile.txt').contents # copies the entire contents of afile.txt into astring
|
63
|
+
#
|
64
|
+
# Alpha Note: Considering removing Rio#contents and Rio#slurp in favor of +to_string+. Is
|
65
|
+
# this the Ruby way? Is it too confusing with a +to_s+ and +to_str+ already? Is it a good idea?
|
66
|
+
def contents() target.contents() end
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
# Rio#each_record
|
71
|
+
#
|
72
|
+
#
|
73
|
+
#def each_record(&block) target.each_record(&block); self end
|
74
|
+
|
75
|
+
|
76
|
+
# Rio#each_row
|
77
|
+
#
|
78
|
+
#
|
79
|
+
#def each_row(&block) target.each_row(&block); self end
|
80
|
+
|
81
|
+
|
82
|
+
# Calls IO#lineno
|
83
|
+
#
|
84
|
+
# Returns the current line number of a Rio.
|
85
|
+
#
|
86
|
+
# The Rio will be opened for reading if not already.
|
87
|
+
# lineno counts the number of times gets is called, rather than the number of newlines encountered --
|
88
|
+
# so lineno will only be accurate if the file is read exclusively with line-oriented methods
|
89
|
+
# (Rio#readline, Rio#each_line, Rio#gets etc.)
|
90
|
+
#
|
91
|
+
# See also the $. variable and Rio#recno
|
92
|
+
# f = rio("testfile")
|
93
|
+
# f.lineno #=> 0
|
94
|
+
# f.gets #=> "This is line one\n"
|
95
|
+
# f.lineno #=> 1
|
96
|
+
# f.gets #=> "This is line two\n"
|
97
|
+
# f.lineno #=> 2
|
98
|
+
def lineno() target.lineno() end
|
99
|
+
|
100
|
+
# Calls IO#lineno=
|
101
|
+
# ario.lineno = integer => integer
|
102
|
+
# Manually sets the current line number to the given value. +$.+ is
|
103
|
+
# updated only on the next read.
|
104
|
+
#
|
105
|
+
# f = rio("testfile")
|
106
|
+
# f.gets #=> "This is line one\n"
|
107
|
+
# $. #=> 1
|
108
|
+
# f.lineno = 1000
|
109
|
+
# f.lineno #=> 1000
|
110
|
+
# $. # lineno of last read #=> 1
|
111
|
+
# f.gets #=> "This is line two\n"
|
112
|
+
# $. # lineno of last read #=> 1001
|
113
|
+
#
|
114
|
+
#
|
115
|
+
def lineno=(integer) target.lineno = integer end
|
116
|
+
|
117
|
+
# Returns the current record number of a Rio. The +recno+ is the index
|
118
|
+
# used by the grande selection methods. It represents the zero-based index of the
|
119
|
+
# last record read. Returns nil until a record has been read.
|
120
|
+
#
|
121
|
+
# see Rio#lines Rio#bytes and Rio#records
|
122
|
+
#
|
123
|
+
# To illustrate: Given a file containing three lines "L0\n","L1\n","L2\n"
|
124
|
+
# and a Range (0..1)
|
125
|
+
# Each of the following would fill ay with ["L0\n", "L1\n"]
|
126
|
+
#
|
127
|
+
# ay = []
|
128
|
+
# range = (0..1)
|
129
|
+
# ain = rio('afile').readlines
|
130
|
+
# ain.each_with_index do |line,i|
|
131
|
+
# ay << line if range === i
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# ay = rio('afile').lines[0..1]
|
135
|
+
#
|
136
|
+
# +recno+ counts the number of times Rio#getrec or Rio#each is used to get a record.
|
137
|
+
# so +recno+ will only concern parts of the file read with grande methods
|
138
|
+
# Rio#each, Rio#[], Rio#getrec
|
139
|
+
#
|
140
|
+
# See also Rio#lineno
|
141
|
+
# f = rio("afile")
|
142
|
+
# r1 = (0..1)
|
143
|
+
# r2 = (100..101)
|
144
|
+
#
|
145
|
+
# aout1 = []
|
146
|
+
# f.each { |rec|
|
147
|
+
# aout << rec if r1 === f.recno or r2 === f.recno
|
148
|
+
# }
|
149
|
+
#
|
150
|
+
# aout2 = f[r1,r2]
|
151
|
+
#
|
152
|
+
# aout1 == aout2 # true
|
153
|
+
#
|
154
|
+
def recno() target.recno() end
|
155
|
+
|
156
|
+
|
157
|
+
# Calls IO#binmode
|
158
|
+
#
|
159
|
+
# Puts rio into binary mode. This is useful only in MS-DOS/Windows environments.
|
160
|
+
# Once a stream is in binary mode, it cannot be reset to nonbinary mode.
|
161
|
+
#
|
162
|
+
# Returns the Rio.
|
163
|
+
#
|
164
|
+
# rio('afile.exe').binmode.bytes(512).to_a # read a file in 512 byte blocks
|
165
|
+
#
|
166
|
+
def binmode() target.binmode(); self end
|
167
|
+
|
168
|
+
|
169
|
+
# Calls IO#flush
|
170
|
+
# ario.flush => ario
|
171
|
+
# Flushes any buffered data within _ario_ to the underlying operating
|
172
|
+
# system (note that this is Ruby internal buffering only; the OS may
|
173
|
+
# buffer the data as well).
|
174
|
+
#
|
175
|
+
def flush() target.flush(); self end
|
176
|
+
|
177
|
+
|
178
|
+
# Calls IO#each_byte
|
179
|
+
# ario.each_byte {|byte| block } => ario
|
180
|
+
# Calls the given block once for each byte (0..255) in _ario_, passing
|
181
|
+
# the byte as an argument.
|
182
|
+
#
|
183
|
+
def each_byte(*args,&block) target.each_byte(*args,&block); self end
|
184
|
+
|
185
|
+
|
186
|
+
# Rio#each_bytes
|
187
|
+
#
|
188
|
+
#
|
189
|
+
#def each_bytes(nb,*args,&block) target.each_bytes(nb,*args,&block); self end
|
190
|
+
|
191
|
+
|
192
|
+
# Calls IO#each_line
|
193
|
+
# ario.each_line(sep_string=$/) {|line| block } => ario
|
194
|
+
# Executes the block for every line in _ario_, where lines are
|
195
|
+
# separated by _sep_string_.
|
196
|
+
#
|
197
|
+
def each_line(*args,&block) target.each_line(*args,&block); self end
|
198
|
+
|
199
|
+
|
200
|
+
# Calls IO#readlines
|
201
|
+
#
|
202
|
+
# Reads all of the lines in a Rio, and returns them in anArray.
|
203
|
+
# Lines are separated by the optional aSepString.
|
204
|
+
# The stream must be opened for reading or an IOerror will be raised.
|
205
|
+
#
|
206
|
+
# an_array = rio('afile.txt').readlines # read afile.txt into an array
|
207
|
+
# an_array = rio('afile.txt').chomp.readlines # read afile.txt into an array with each line chomped
|
208
|
+
#
|
209
|
+
def readlines(*args,&block) target.readlines(*args,&block) end
|
210
|
+
|
211
|
+
# Calls IO#readline
|
212
|
+
# ario.readline(sep_string=$/) => string
|
213
|
+
# Reads a line as with +IO#gets+, but raises an +EOFError+ on end of
|
214
|
+
# file.
|
215
|
+
#
|
216
|
+
def readline(*args) target.readline(*args) end
|
217
|
+
|
218
|
+
|
219
|
+
# Calls IO::print
|
220
|
+
#
|
221
|
+
# Writes the given object(s) to the Rio. If the output record separator ($\) is not nil,
|
222
|
+
# it will be appended to the output. If no arguments are given, prints $_.
|
223
|
+
# Objects that aren't strings will be converted by calling their to_s method.
|
224
|
+
# Returns the Rio.
|
225
|
+
#
|
226
|
+
# rio('f.txt').print("Hello Rio\n") # print the string to f.txt
|
227
|
+
# rio(?-).print("Hello Rio\n") # print the string to stdout
|
228
|
+
#
|
229
|
+
def print(*args,&block) target.print(*args,&block); self end
|
230
|
+
|
231
|
+
# Writes the given objects to the rio as with Rio#print and then closes the Rio.
|
232
|
+
# Returns the Rio.
|
233
|
+
#
|
234
|
+
# Equivalent to rio.print(*args).close
|
235
|
+
#
|
236
|
+
# rio('f.txt').print!("Hello Rio\n") # print the string to f.txt then close it
|
237
|
+
#
|
238
|
+
def print!(*args,&block) target.print!(*args,&block); self end
|
239
|
+
|
240
|
+
|
241
|
+
# Writes the given objects to the rio as with Rio#printf and then closes the rio.
|
242
|
+
# Returns the rio.
|
243
|
+
#
|
244
|
+
# Equivalent to rio.printf(*args).close
|
245
|
+
#
|
246
|
+
def printf!(*argv) target.printf!(*argv); self end
|
247
|
+
|
248
|
+
|
249
|
+
# Calls IO#printf
|
250
|
+
# ario.printf(format_string [, obj, ...] ) => ario
|
251
|
+
# Formats and writes to _ario_, converting parameters under control of
|
252
|
+
# the format string. See +Kernel#sprintf+ for details.
|
253
|
+
#
|
254
|
+
def printf(*argv) target.printf(*argv); self end
|
255
|
+
|
256
|
+
|
257
|
+
# Writes the given objects to the rio as with Rio#putc and then closes the rio.
|
258
|
+
# Returns the rio.
|
259
|
+
#
|
260
|
+
# Equivalent to rio.putc(*args).close
|
261
|
+
#
|
262
|
+
def putc!(*argv) target.putc!(*argv); self end
|
263
|
+
|
264
|
+
|
265
|
+
# Calls IO#putc
|
266
|
+
# ario.putc(obj) => ario
|
267
|
+
# If _obj_ is +Numeric+, write the character whose code is _obj_,
|
268
|
+
# otherwise write the first character of the string representation of
|
269
|
+
# _obj_ to _ario_.
|
270
|
+
#
|
271
|
+
# stdout = rio(?-)
|
272
|
+
# stdout.putc "A"
|
273
|
+
# stdout.putc 65
|
274
|
+
#
|
275
|
+
# _produces:_
|
276
|
+
#
|
277
|
+
# AA
|
278
|
+
#
|
279
|
+
def putc(*argv) target.putc(*argv); self end
|
280
|
+
|
281
|
+
|
282
|
+
# Calls IO#puts
|
283
|
+
#
|
284
|
+
# Writes the given objects to the rio as with Rio#print .
|
285
|
+
# Writes a record separator (typically a newline) after any that do not already end with a newline sequence.
|
286
|
+
# If called with an array argument, writes each element on a new line.
|
287
|
+
# If called without arguments, outputs a single record separator.
|
288
|
+
# Returns the rio.
|
289
|
+
def puts(*args) target.puts(*args); self end
|
290
|
+
|
291
|
+
# Writes the given objects to the rio as with Rio#puts and then closes the rio.
|
292
|
+
# Returns the rio.
|
293
|
+
#
|
294
|
+
# Equivalent to rio.puts(*args).close
|
295
|
+
#
|
296
|
+
# rio('f.txt').puts!('Hello Rio') # print the string to f.txt then close it
|
297
|
+
#
|
298
|
+
def puts!(*args) target.puts!(*args); self end
|
299
|
+
|
300
|
+
|
301
|
+
# Writes the given objects to the rio as with Rio#write and then closes the rio.
|
302
|
+
#
|
303
|
+
# Equivalent to
|
304
|
+
# ario.write(*args)
|
305
|
+
# ario.close
|
306
|
+
#
|
307
|
+
def write!(*argv) target.write!(*argv); self end
|
308
|
+
|
309
|
+
|
310
|
+
# Calls IO#write
|
311
|
+
# ario.write(string) => integer
|
312
|
+
# Writes the given string to _ario_. If the argument is not a string,
|
313
|
+
# it will be converted to a
|
314
|
+
# string using +to_s+. Returns the number of bytes written.
|
315
|
+
#
|
316
|
+
def write(*argv) target.write(*argv); self end
|
317
|
+
|
318
|
+
|
319
|
+
# Calls IO#eof?
|
320
|
+
# ario.eof => true or false
|
321
|
+
# Returns true if _ario_ is at end of file. The stream must be opened
|
322
|
+
# for reading or an +IOError+ will be raised.
|
323
|
+
#
|
324
|
+
def eof?() target.eof? end
|
325
|
+
|
326
|
+
# Provides direct access to the IO handle (as would be returned by ::IO#new) *with* filtering.
|
327
|
+
# Reading from and writing to this handle will be affected
|
328
|
+
# by such things as Rio#gzip and Rio#chomp if they were specified for the Rio.
|
329
|
+
#
|
330
|
+
# Compare this with Rio#ios
|
331
|
+
#
|
332
|
+
def ioh(*args) target.ioh() end
|
333
|
+
|
334
|
+
# Provides direct access to the IO handle (as would be returned by ::IO#new)
|
335
|
+
# Reading from and writing to this handle
|
336
|
+
# is *not* affected by such things as Rio#gzip and Rio#chomp.
|
337
|
+
#
|
338
|
+
# Compare this with Rio#ioh
|
339
|
+
#
|
340
|
+
def ios(*args) target.ios() end
|
341
|
+
|
342
|
+
#def open(m,*args) target.open(m,*args); self end
|
343
|
+
|
344
|
+
# Explicitly set the mode with which a Rio will be opened.
|
345
|
+
# ario.mode('r+') => ario
|
346
|
+
# Normally one needs never open a Rio or specify its mode -- the mode is determined by the
|
347
|
+
# operation the Rio is asked to perform. (i.e. Rio#print requires write access, Rio#readlines requires
|
348
|
+
# read access). However there are times when one wishes to be specific about the mode with which a Rio
|
349
|
+
# will be opened. Note that explicitly setting the mode overrides all of Rio's internal mode
|
350
|
+
# logic. If a mode is specified via Rio#mode or Rio#open that mode will be used. Period.
|
351
|
+
#
|
352
|
+
# Returns the Rio.
|
353
|
+
#
|
354
|
+
# See also Rio#mode?
|
355
|
+
#
|
356
|
+
# If the mode is given as a String, it must be one of the values listed in the following table.
|
357
|
+
#
|
358
|
+
# Mode | Meaning
|
359
|
+
# -----+--------------------------------------------------------
|
360
|
+
# "r" | Read-only, starts at beginning of file (default mode).
|
361
|
+
# -----+--------------------------------------------------------
|
362
|
+
# "r+" | Read-write, starts at beginning of file.
|
363
|
+
# -----+--------------------------------------------------------
|
364
|
+
# "w" | Write-only, truncates existing file
|
365
|
+
# | to zero length or creates a new file for writing.
|
366
|
+
# -----+--------------------------------------------------------
|
367
|
+
# "w+" | Read-write, truncates existing file to zero length
|
368
|
+
# | or creates a new file for reading and writing.
|
369
|
+
# -----+--------------------------------------------------------
|
370
|
+
# "a" | Write-only, starts at end of file if file exists,
|
371
|
+
# | otherwise creates a new file for writing.
|
372
|
+
# -----+--------------------------------------------------------
|
373
|
+
# "a+" | Read-write, starts at end of file if file exists,
|
374
|
+
# | otherwise creates a new file for reading and
|
375
|
+
# | writing.
|
376
|
+
# -----+--------------------------------------------------------
|
377
|
+
# "b" | (DOS/Windows only) Binary file mode (may appear with
|
378
|
+
# | any of the key letters listed above).
|
379
|
+
#
|
380
|
+
# ario = rio('afile').mode('r+').nocloseoneof # file will be opened in r+ mode
|
381
|
+
# # don't want the file closed at eof
|
382
|
+
# ario.seek(apos).gets # read the string at apos in afile
|
383
|
+
# ario.rewind.gets # read the string at the beginning of the file
|
384
|
+
# ario.close
|
385
|
+
#
|
386
|
+
# TODO:
|
387
|
+
# * Add support for integer modes
|
388
|
+
#
|
389
|
+
def mode(m,*args) target.mode(m,*args); self end
|
390
|
+
|
391
|
+
# Query a Rio's mode
|
392
|
+
# ario.mode? #=> a mode string
|
393
|
+
#
|
394
|
+
# See Rio#mode
|
395
|
+
#
|
396
|
+
# ario = rio('afile')
|
397
|
+
# ario.puts("Hello World")
|
398
|
+
# ario.mode? #=> 'w' Rio#puts requires write access
|
399
|
+
#
|
400
|
+
# ario = rio('afile')
|
401
|
+
# ario.gets
|
402
|
+
# ario.mode? #=> 'r' Rio#gets requires read access
|
403
|
+
#
|
404
|
+
# ario = rio('afile').mode('w+').nocloseoneof
|
405
|
+
# ario.gets
|
406
|
+
# ario.mode? #=> 'w+' Set explictly
|
407
|
+
#
|
408
|
+
def mode?() target.mode?() end
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
# Calls IO#close
|
413
|
+
# ario.close => nil
|
414
|
+
# Closes _ario_ and flushes any pending writes to the operating
|
415
|
+
# system. The stream is unavailable for any further data operations;
|
416
|
+
# an +IOError+ is raised if such an attempt is made. I/O streams are
|
417
|
+
# automatically closed when they are claimed by the garbage
|
418
|
+
# collector.
|
419
|
+
#
|
420
|
+
def close() target.close(); self end
|
421
|
+
|
422
|
+
# Calls IO#fcntl
|
423
|
+
# ario.fcntl(integer_cmd, arg) => integer
|
424
|
+
# Provides a mechanism for issuing low-level commands to control or
|
425
|
+
# query file-oriented I/O streams. Arguments and results are platform
|
426
|
+
# dependent. If _arg_ is a number, its value is passed directly. If
|
427
|
+
# it is a string, it is interpreted as a binary sequence of bytes
|
428
|
+
# (+Array#pack+ might be a useful way to build this string). On Unix
|
429
|
+
# platforms, see +fcntl(2)+ for details. Not implemented on all
|
430
|
+
# platforms.
|
431
|
+
#
|
432
|
+
#
|
433
|
+
def fcntl(integer_cmd,arg) target.fcntl(integer_cmd,arg) end
|
434
|
+
|
435
|
+
# Calls IO#ioctl
|
436
|
+
# ario.ioctl(integer_cmd, arg) => integer
|
437
|
+
# Provides a mechanism for issuing low-level commands to control or
|
438
|
+
# query I/O devices. Arguments and results are platform dependent. If
|
439
|
+
# _arg_ is a number, its value is passed directly. If it is a string,
|
440
|
+
# it is interpreted as a binary sequence of bytes. On Unix platforms,
|
441
|
+
# see +ioctl(2)+ for details. Not implemented on all platforms.
|
442
|
+
#
|
443
|
+
#
|
444
|
+
def ioctl(integer_cmd,arg) target.ioctl(integer_cmd,arg) end
|
445
|
+
|
446
|
+
# Calls IO#fileno
|
447
|
+
# ario.fileno => fixnum
|
448
|
+
# ario.to_i => fixnum
|
449
|
+
# Returns an integer representing the numeric file descriptor for
|
450
|
+
# _ario_.
|
451
|
+
#
|
452
|
+
def fileno() target.fileno() end
|
453
|
+
|
454
|
+
|
455
|
+
# Calls IO#fsync
|
456
|
+
# ario.fsync => ario
|
457
|
+
# Immediately writes all buffered data in _ario_ to disk and
|
458
|
+
# return _ario_.
|
459
|
+
# Does nothing if the underlying operating system does not support
|
460
|
+
# _fsync(2)_. Note that +fsync+ differs from using Rio#sync. The
|
461
|
+
# latter ensures that data is flushed from Ruby's buffers, but
|
462
|
+
# doesn't not guarantee that the underlying operating system actually
|
463
|
+
# writes it to disk.
|
464
|
+
#
|
465
|
+
def fsync() target.fsync end
|
466
|
+
|
467
|
+
# Calls IO#pid
|
468
|
+
# ario.pid => fixnum
|
469
|
+
# Returns the process ID of a child process associated with _ario_.
|
470
|
+
# This will be set by +IO::popen+.
|
471
|
+
#
|
472
|
+
# pipe = IO.popen("-")
|
473
|
+
# if pipe
|
474
|
+
# $stderr.puts "In parent, child pid is #{pipe.pid}"
|
475
|
+
# else
|
476
|
+
# $stderr.puts "In child, pid is #{$$}"
|
477
|
+
# end
|
478
|
+
#
|
479
|
+
# _produces:_
|
480
|
+
#
|
481
|
+
# In child, pid is 26209
|
482
|
+
# In parent, child pid is 26209
|
483
|
+
#
|
484
|
+
#
|
485
|
+
|
486
|
+
|
487
|
+
# Calls IO#putc
|
488
|
+
# ario.putc(obj) => obj
|
489
|
+
# If _obj_ is +Numeric+, write the character whose code is _obj_,
|
490
|
+
# otherwise write the first character of the string representation of
|
491
|
+
# _obj_ to _ario_.
|
492
|
+
#
|
493
|
+
# $stdout.putc "A"
|
494
|
+
# $stdout.putc 65
|
495
|
+
#
|
496
|
+
# _produces:_
|
497
|
+
#
|
498
|
+
# AA
|
499
|
+
#
|
500
|
+
#
|
501
|
+
|
502
|
+
|
503
|
+
# Calls IO#getc
|
504
|
+
# ario.getc => fixnum or nil
|
505
|
+
# Gets the next 8-bit byte (0..255) from _ario_. Returns +nil+ if
|
506
|
+
# called at end of file.
|
507
|
+
#
|
508
|
+
# f = File.new("testfile")
|
509
|
+
# f.getc #=> 84
|
510
|
+
# f.getc #=> 104
|
511
|
+
#
|
512
|
+
#
|
513
|
+
|
514
|
+
# Calls IO#readchar
|
515
|
+
# ario.readchar => fixnum
|
516
|
+
# Reads a character as with +IO#getc+, but raises an +EOFError+ on
|
517
|
+
# end of file.
|
518
|
+
#
|
519
|
+
#
|
520
|
+
|
521
|
+
# Calls IO#reopen
|
522
|
+
# ario.reopen(other_IO) => ios
|
523
|
+
# ario.reopen(path, mode_str) => ios
|
524
|
+
# Reassociates _ario_ with the I/O stream given in _other_IO_ or to a
|
525
|
+
# new stream opened on _path_. This may dynamically change the actual
|
526
|
+
# class of this stream.
|
527
|
+
#
|
528
|
+
# f1 = File.new("testfile")
|
529
|
+
# f2 = File.new("testfile")
|
530
|
+
# f2.readlines[0] #=> "This is line one\n"
|
531
|
+
# f2.reopen(f1) #=> #<File:testfile>
|
532
|
+
# f2.readlines[0] #=> "This is line one\n"
|
533
|
+
#
|
534
|
+
#
|
535
|
+
|
536
|
+
# Calls IO#stat
|
537
|
+
# ario.stat => stat
|
538
|
+
# Returns status information for _ario_ as an object of type
|
539
|
+
# +File::Stat+.
|
540
|
+
#
|
541
|
+
# f = File.new("testfile")
|
542
|
+
# s = f.stat
|
543
|
+
# "%o" % s.mode #=> "100644"
|
544
|
+
# s.blksize #=> 4096
|
545
|
+
# s.atime #=> Wed Apr 09 08:53:54 CDT 2003
|
546
|
+
#
|
547
|
+
#
|
548
|
+
|
549
|
+
# Calls IO#tell
|
550
|
+
# ario.pos => integer
|
551
|
+
# ario.tell => integer
|
552
|
+
# Returns the current offset (in bytes) of _ario_.
|
553
|
+
#
|
554
|
+
# f = rio("testfile")
|
555
|
+
# f.pos #=> 0
|
556
|
+
# f.gets #=> "This is line one\n"
|
557
|
+
# f.pos #=> 17
|
558
|
+
#
|
559
|
+
#
|
560
|
+
|
561
|
+
# Calls IO#to_i
|
562
|
+
# to_i()
|
563
|
+
# Alias for #fileno
|
564
|
+
#
|
565
|
+
#
|
566
|
+
|
567
|
+
# Calls IO#to_io
|
568
|
+
# ario.to_io -> ios
|
569
|
+
# Returns _ario_.
|
570
|
+
#
|
571
|
+
#
|
572
|
+
|
573
|
+
# Calls IO#tty?
|
574
|
+
# ario.tty? => true or false
|
575
|
+
# Returns +true+ if _ario_ is associated with a terminal device (tty),
|
576
|
+
# +false+ otherwise.
|
577
|
+
#
|
578
|
+
# rio("testfile").tty? #=> false
|
579
|
+
# rio("/dev/tty").tty? #=> true
|
580
|
+
#
|
581
|
+
#
|
582
|
+
def tty?() target.tty?() end
|
583
|
+
|
584
|
+
# Calls IO#ungetc
|
585
|
+
# ario.ungetc(integer) => ario
|
586
|
+
# Pushes back one character (passed as a parameter) onto _ario_, such
|
587
|
+
# that a subsequent buffered read will return it. Only one character
|
588
|
+
# may be pushed back before a subsequent read operation (that is, you
|
589
|
+
# will be able to read only the last of several characters that have
|
590
|
+
# been pushed back).
|
591
|
+
#
|
592
|
+
# f = rio("testfile") #=> #<Rio:testfile>
|
593
|
+
# c = f.getc #=> 84
|
594
|
+
# f.ungetc(c).getc #=> 84
|
595
|
+
#
|
596
|
+
def ungetc(*args) target.ungetc(*args); self end
|
597
|
+
|
598
|
+
end
|
599
|
+
end
|