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
@@ -0,0 +1,443 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: RIO::Doc::MISC</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td class="class-mod"><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">RIO::Doc::MISC</td>
|
54
|
+
<td rowspan="2" class="class-header-space-col"></td>
|
55
|
+
<td rowspan="2">
|
56
|
+
<a class="in-url" href="../../../files/lib/rio/doc/MISC_rb.html">
|
57
|
+
lib/rio/doc/MISC.rb
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</td>
|
61
|
+
</tr>
|
62
|
+
|
63
|
+
</table>
|
64
|
+
</div>
|
65
|
+
<!-- banner header -->
|
66
|
+
|
67
|
+
<div id="bodyContent">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<div id="contextContent">
|
72
|
+
|
73
|
+
<div id="description">
|
74
|
+
<p>
|
75
|
+
The following example are provided without comment
|
76
|
+
</p>
|
77
|
+
<pre>
|
78
|
+
array = rio('afile').readlines
|
79
|
+
|
80
|
+
rio('afile') > rio('acopy')
|
81
|
+
|
82
|
+
ary = rio('afile').chomp.lines[0...10]
|
83
|
+
|
84
|
+
rio('adir').rename.all.files('*.htm') do |file|
|
85
|
+
file.ext = '.html'
|
86
|
+
end
|
87
|
+
</pre>
|
88
|
+
<p>
|
89
|
+
A basic familiarity with ruby and shell operations should allow a casual
|
90
|
+
reader to guess what these examples will do. How they are being performed
|
91
|
+
may not be what a casual reader might expect. I will explain these example
|
92
|
+
to illustrate the <a href="../Rio.html">Rio</a> basics.
|
93
|
+
</p>
|
94
|
+
<p>
|
95
|
+
For many more examples please read the <a href="HOWTO.html">HOWTO</a>
|
96
|
+
document and the rdoc documentation.
|
97
|
+
</p>
|
98
|
+
<h2>Example 1.</h2>
|
99
|
+
<pre>
|
100
|
+
array = rio('afile').readlines
|
101
|
+
</pre>
|
102
|
+
<p>
|
103
|
+
This uses IO#readlines to read the lines of ‘afile’ into an
|
104
|
+
array.
|
105
|
+
</p>
|
106
|
+
<h3>Creating a <a href="../Rio.html">Rio</a></h3>
|
107
|
+
<p>
|
108
|
+
<a href="../Rio.html">Rio</a> extends the module <a
|
109
|
+
href="../../Kernel.html">Kernel</a> by adding one function <em>rio</em>,
|
110
|
+
which acts as a constructor returning a <a href="../Rio.html">Rio</a>. This
|
111
|
+
constructor builds a description of the resource the <a
|
112
|
+
href="../Rio.html">Rio</a> will access (usually a path). It does not open
|
113
|
+
the resource, check for its existance, or do anything except remember its
|
114
|
+
specifcation. <em>rio</em> returns the <a href="../Rio.html">Rio</a> which
|
115
|
+
can be chained to a <a href="../Rio.html">Rio</a> method as in this example
|
116
|
+
or stored in a variable. This coud have been written
|
117
|
+
</p>
|
118
|
+
<pre>
|
119
|
+
ario = rio('afile')
|
120
|
+
array = ario.readlines
|
121
|
+
|
122
|
+
ario = rio('afile')
|
123
|
+
</pre>
|
124
|
+
<p>
|
125
|
+
In this case the resource specified is a relative path. After the first
|
126
|
+
line the <a href="../Rio.html">Rio</a> does know or care whether it is a
|
127
|
+
path to a file nor whether it exists. <a href="../Rio.html">Rio</a>
|
128
|
+
provides many methods that only deal with a resource at this level, much as
|
129
|
+
the standard library classes Pathname and URI. It should be noted at this
|
130
|
+
point that <a href="../Rio.html">Rio</a> paths stored internally as a URL
|
131
|
+
as specified in RFC 1738 and therefore use slashes as separators. A
|
132
|
+
resource can also be specified without separators, because <em>rio</em>
|
133
|
+
interprets multiple arguments as parts of a path to be joined, and an array
|
134
|
+
as an array of parts to be joined. So the following all specify the same
|
135
|
+
resource.
|
136
|
+
</p>
|
137
|
+
<pre>
|
138
|
+
rio('adir/afile')
|
139
|
+
rio('adir','afile')
|
140
|
+
rio(%w/adir afile/)
|
141
|
+
</pre>
|
142
|
+
<p>
|
143
|
+
The rio constructor can be used to specify non-file-system resources, but
|
144
|
+
for this example we will restrict our discussion to paths to entities on
|
145
|
+
file-systems.
|
146
|
+
</p>
|
147
|
+
<pre>
|
148
|
+
array = ario.readlines
|
149
|
+
</pre>
|
150
|
+
<p>
|
151
|
+
Now that we have a <a href="../Rio.html">Rio</a>, we can call one of its
|
152
|
+
methods; in this case <em>readlines</em>. This is an example of using a <a
|
153
|
+
href="../Rio.html">Rio</a> as a proxy for the builtin IO#readlines. Given
|
154
|
+
the method <em>readlines</em>, the <a href="../Rio.html">Rio</a> opens
|
155
|
+
‘afile’ for reading, calls readlines on the resulting IO
|
156
|
+
object, closes the IO object, and returns the lines read.
|
157
|
+
</p>
|
158
|
+
<h2>Example 2</h2>
|
159
|
+
<pre>
|
160
|
+
rio('afile') > rio('acopy')
|
161
|
+
</pre>
|
162
|
+
<p>
|
163
|
+
This copies the file ‘afile’ into the file ‘acopy’.
|
164
|
+
</p>
|
165
|
+
<p>
|
166
|
+
The first things that happen here are the creation of the Rios. As
|
167
|
+
described in Example 1, when created a <a href="../Rio.html">Rio</a> simply
|
168
|
+
remembers the specifcation of its resource. In this case, a relative path
|
169
|
+
‘afile’ on the left and a relative path ‘acopy’ on
|
170
|
+
the right.
|
171
|
+
</p>
|
172
|
+
<p>
|
173
|
+
Next the <a href="../Rio.html">Rio</a>#> (copy-to) method is called on
|
174
|
+
the ‘afile’ <a href="../Rio.html">Rio</a> with the
|
175
|
+
‘acopy’ <a href="../Rio.html">Rio</a> as its argument. If that
|
176
|
+
looks like a greater-than operator to you, think Unix shell, with Rios
|
177
|
+
’>’ is the copy-to operator.
|
178
|
+
</p>
|
179
|
+
<p>
|
180
|
+
Upon seeing the copy-to operator, the <a href="../Rio.html">Rio</a> has all
|
181
|
+
the information it needs to proceed. It determines that it must be opened
|
182
|
+
for reading, that its argument must be opened for writing, and that
|
183
|
+
it’s contents must be copied to the resource referenced by it’
|
184
|
+
argument — and that is what it does. Then it closes itself and its
|
185
|
+
argument.
|
186
|
+
</p>
|
187
|
+
<p>
|
188
|
+
Consider if we had written this example this way.
|
189
|
+
</p>
|
190
|
+
<pre>
|
191
|
+
afile = rio('afile')
|
192
|
+
acopy = rio('acopy')
|
193
|
+
afile > acopy
|
194
|
+
</pre>
|
195
|
+
<p>
|
196
|
+
In this case we would still have variables referencing the Rios, and
|
197
|
+
perhaps we would like do things a little differently than described above.
|
198
|
+
Be assured that the selection of mode and automatic closing of files are
|
199
|
+
the default behaviour and can be changed. Say we wanted ‘afile’
|
200
|
+
to remain open so that we could rewind it and make a second copy, we might
|
201
|
+
do something like this:
|
202
|
+
</p>
|
203
|
+
<pre>
|
204
|
+
afile = rio('afile').nocloseoneof
|
205
|
+
afile > rio('acopy1')
|
206
|
+
afile.rewind > rio('acopy2')
|
207
|
+
afile.close
|
208
|
+
</pre>
|
209
|
+
<p>
|
210
|
+
Actually the ‘thinking-process’ of the <a
|
211
|
+
href="../Rio.html">Rio</a> when it sees a copy-to operator is much more
|
212
|
+
complex that described above. If its argument had been a rio referencing a
|
213
|
+
directory, it would not have opened itself for reading, but instead used
|
214
|
+
FileUtils#cp to copy itself; if its argument had been a string, its
|
215
|
+
contents would have ended up in the string; If its argument had been an
|
216
|
+
array, its lines would been elements of that array; if its argument had
|
217
|
+
been a socket, the its contents would have been copied to the socket. See
|
218
|
+
the documentation for details.
|
219
|
+
</p>
|
220
|
+
<h2>Example 3.</h2>
|
221
|
+
<pre>
|
222
|
+
array = rio('afile').chomp.lines[0...10]
|
223
|
+
</pre>
|
224
|
+
<p>
|
225
|
+
This fills <tt>array</tt> with the first ten lines of ‘afile’,
|
226
|
+
with each line chomped
|
227
|
+
</p>
|
228
|
+
<p>
|
229
|
+
The casual observer mentioned above might think that <tt>lines</tt> returns
|
230
|
+
an array of lines and that this is a simple rewording of <tt>array = <a
|
231
|
+
href="http://0...10">rio('afile').readlines</a></tt> or even of <tt>array =
|
232
|
+
<a href="http://0...10">File.new('afile').readlines</a></tt>. They would be
|
233
|
+
wrong.
|
234
|
+
</p>
|
235
|
+
<p>
|
236
|
+
<tt>chomp</tt> is a configuration method which turns on chomp-mode and
|
237
|
+
returns the <a href="../Rio.html">Rio</a>. Chomp-mode causes all line
|
238
|
+
oriented read operations to perform a String#chomp on each line
|
239
|
+
</p>
|
240
|
+
<h3>Reading files</h3>
|
241
|
+
<p>
|
242
|
+
<a href="../Rio.html">Rio</a> provides four methods to select which part of
|
243
|
+
the file is read and how the file is divided. They are <tt>lines</tt>,
|
244
|
+
<tt>records</tt>, <tt>rows</tt> and <tt>bytes</tt>. Briefly, <tt>lines</tt>
|
245
|
+
specifies that the file should be read line by line and +bytes(n)+
|
246
|
+
specifies that the file should be read in <em>n</em> byte chunks. All four
|
247
|
+
take arguments which can be used to filter lines or chunks in or out. For
|
248
|
+
simple Rios <tt>records</tt> and <tt>rows</tt> only specify the filter
|
249
|
+
arguments and are provided for use be extensions. For example, the CSV
|
250
|
+
extension returns an array of the columns in a line when <tt>records</tt>
|
251
|
+
is used. In the absence of an extension <tt>records</tt> and <tt>rows</tt>
|
252
|
+
behave like <tt>lines</tt>.
|
253
|
+
</p>
|
254
|
+
<p>
|
255
|
+
First lets rewrite our example as:
|
256
|
+
</p>
|
257
|
+
<pre>
|
258
|
+
array = rio('afile').chomp.lines(0...10).to_a
|
259
|
+
</pre>
|
260
|
+
<p>
|
261
|
+
The arguments to lines specify which records are to be read. Arguments are
|
262
|
+
interpreted based on their class as follows:
|
263
|
+
</p>
|
264
|
+
<ul>
|
265
|
+
<li>Range - interpreted as a range of record numbers to be read
|
266
|
+
|
267
|
+
</li>
|
268
|
+
<li>Integer - interpreted as a one-element range
|
269
|
+
|
270
|
+
</li>
|
271
|
+
<li>RegExp - only matching records are processed
|
272
|
+
|
273
|
+
</li>
|
274
|
+
<li>Symbol - sent to each record, which is processed unless the result is false
|
275
|
+
or nil
|
276
|
+
|
277
|
+
</li>
|
278
|
+
<li>Proc - called for each record, the record is processed unless the return
|
279
|
+
value is false or nil
|
280
|
+
|
281
|
+
</li>
|
282
|
+
</ul>
|
283
|
+
<p>
|
284
|
+
See the documentation for details and examples.
|
285
|
+
</p>
|
286
|
+
<p>
|
287
|
+
In our example we have specified the Range (0...10). The <tt>lines</tt>
|
288
|
+
method is just configuring the <a href="../Rio.html">Rio</a>, it does not
|
289
|
+
trigger any IO operation. The fact that it was called and the arguments it
|
290
|
+
was called with are stored away and the <a href="../Rio.html">Rio</a> is
|
291
|
+
returned for further configuration or an actual IO operation. When an IO
|
292
|
+
operation is called the Range will be used to limit processing to the first
|
293
|
+
ten records. For example:
|
294
|
+
</p>
|
295
|
+
<pre>
|
296
|
+
rio('afile').lines(0...10).each { |line| ... } # block will be called for the first 10 records
|
297
|
+
rio('afile').lines(0...10).to_a # the first 10 records will be returned in an array
|
298
|
+
rio('afile').lines(0...10) > rio('acopy') # the first 10 records will be copied to 'acopy'
|
299
|
+
</pre>
|
300
|
+
<p>
|
301
|
+
"But wait", you say, "In our original example the range was
|
302
|
+
an argument to the subscript operator, not to <tt>lines</tt>". This
|
303
|
+
works because the subscript operator processes its arguments as if they had
|
304
|
+
been arguments to the most-recently-called selection method and then calls
|
305
|
+
<tt>to_a</tt> on the rio. So our rewrite of the example does precisely the
|
306
|
+
same thing as the original
|
307
|
+
</p>
|
308
|
+
<p>
|
309
|
+
The big difference between the original example and the
|
310
|
+
casual-observer’s solution is that hers creates an array of the
|
311
|
+
entire contents and only returns the first 10 while the original only puts
|
312
|
+
10 records into the array.
|
313
|
+
</p>
|
314
|
+
<p>
|
315
|
+
As a sidenote, Rios also have an optimization that can really help in
|
316
|
+
certain situations. If records are only selected using Ranges, it stops
|
317
|
+
iterating when it is beyond the point where it could possibly ever match.
|
318
|
+
This can make a dramatic difference when one is only interested in the
|
319
|
+
first few lines of very large files.
|
320
|
+
</p>
|
321
|
+
<h2>Example 4.</h2>
|
322
|
+
<pre>
|
323
|
+
rio('adir').rename.all.files('*.htm') do |file|
|
324
|
+
file.ext = '.html'
|
325
|
+
end
|
326
|
+
</pre>
|
327
|
+
<p>
|
328
|
+
This changes the extension of all .htm files below ‘adir’ to
|
329
|
+
’.html’
|
330
|
+
</p>
|
331
|
+
<p>
|
332
|
+
First we create the rio as always.
|
333
|
+
</p>
|
334
|
+
<p>
|
335
|
+
Next we process the <tt>rename</tt> method. When used as it is here —
|
336
|
+
without arguments — it just turns on rename-mode and returns the <a
|
337
|
+
href="../Rio.html">Rio</a>.
|
338
|
+
</p>
|
339
|
+
<p>
|
340
|
+
<tt>all</tt> is another configuration method, which causes directories to
|
341
|
+
be processed recursively
|
342
|
+
</p>
|
343
|
+
<p>
|
344
|
+
<tt>files</tt> is another configuration method. In example 3 we used
|
345
|
+
<tt>lines</tt> to select what to process when iterating through a file.
|
346
|
+
<tt>files</tt> is used to select what to process when iterating through
|
347
|
+
directories. The arguments to <tt>files</tt> can be the same as those for
|
348
|
+
<tt>lines</tt> except that Ranges can not be used and globs can.
|
349
|
+
</p>
|
350
|
+
<p>
|
351
|
+
In our example, the argument to <tt>files</tt> is a string which is treated
|
352
|
+
as a glob. As with <tt>lines</tt>, <tt>files</tt> does not trigger any IO,
|
353
|
+
it just configures the <a href="../Rio.html">Rio</a>.
|
354
|
+
</p>
|
355
|
+
<h3>There’s no action</h3>
|
356
|
+
<p>
|
357
|
+
The previous examples had something that triggered IO: <tt>readlines</tt>,
|
358
|
+
<tt>to_a</tt>, <tt>each</tt>, <tt>> (copy-to)</tt>. This example does
|
359
|
+
not. This example illustrates <a href="../Rio.html">Rio</a>’s
|
360
|
+
‘implied each’. All the configuration methods will call each
|
361
|
+
for you if a block is given. So, because a block follows the files method,
|
362
|
+
it calls <tt>each</tt> and passes it the block.
|
363
|
+
</p>
|
364
|
+
<p>
|
365
|
+
Let’s recap. At this point we have a <a href="../Rio.html">Rio</a>
|
366
|
+
with a resource specified. We have configured with a couple of modes,
|
367
|
+
‘rename’, and ‘all’, and we have limited the
|
368
|
+
elements we want to process to entries that are files and match the glob
|
369
|
+
’*.htm’. <tt>each</tt> causes the <a href="../Rio.html">Rio</a>
|
370
|
+
to open the directory and call the block for each entry that is both a file
|
371
|
+
and matches the glob. It was also configured with <tt>all</tt>,so it
|
372
|
+
descends into subdirectories to find further matches and calles the block
|
373
|
+
for each of them. The argument passed to the block is a <a
|
374
|
+
href="../Rio.html">Rio</a> referencing the entry on the file-system.
|
375
|
+
</p>
|
376
|
+
<p>
|
377
|
+
The <em>rename_mode</em> we set has had no effect on our iteration at all,
|
378
|
+
so why is it there? In general, configuration options that are not
|
379
|
+
applicable to a <a href="../Rio.html">Rio</a> are silently ignored,
|
380
|
+
however, for directories some of them are passed on to the Rios for each
|
381
|
+
entry when iterating. Since <tt>rename</tt> is one such option, The example
|
382
|
+
could have been written:
|
383
|
+
</p>
|
384
|
+
<pre>
|
385
|
+
rio('adir').all.files('*.htm') do |file|
|
386
|
+
file.rename.ext = '.html'
|
387
|
+
end
|
388
|
+
</pre>
|
389
|
+
<p>
|
390
|
+
The rename-with-no-args method affects the behaviour of the <tt>ext=</tt>
|
391
|
+
option. In this case, setting it for the directory, rather than for each
|
392
|
+
file in the block seems to make the intent of the code more clear, but that
|
393
|
+
is a matter of personal taste. See the documentation for more information
|
394
|
+
on the rename-with-no-args method
|
395
|
+
</p>
|
396
|
+
<h2>Suggested Reading</h2>
|
397
|
+
<ul>
|
398
|
+
<li><a href="SYNOPSIS.html">RIO::Doc::SYNOPSIS</a>
|
399
|
+
|
400
|
+
</li>
|
401
|
+
<li><a href="INTRO.html">RIO::Doc::INTRO</a>
|
402
|
+
|
403
|
+
</li>
|
404
|
+
<li><a href="HOWTO.html">RIO::Doc::HOWTO</a>
|
405
|
+
|
406
|
+
</li>
|
407
|
+
<li><a href="../Rio.html">RIO::Rio</a>
|
408
|
+
|
409
|
+
</li>
|
410
|
+
</ul>
|
411
|
+
|
412
|
+
</div>
|
413
|
+
|
414
|
+
|
415
|
+
</div>
|
416
|
+
|
417
|
+
|
418
|
+
</div>
|
419
|
+
|
420
|
+
|
421
|
+
<!-- if includes -->
|
422
|
+
|
423
|
+
<div id="section">
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
<!-- if method_list -->
|
433
|
+
|
434
|
+
|
435
|
+
</div>
|
436
|
+
|
437
|
+
|
438
|
+
<div id="validator-badges">
|
439
|
+
<p><small>Copyright © 2005 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
|
440
|
+
</div>
|
441
|
+
|
442
|
+
</body>
|
443
|
+
</html>
|
@@ -0,0 +1,325 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: RIO::Doc::SYNOPSIS</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td class="class-mod"><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">RIO::Doc::SYNOPSIS</td>
|
54
|
+
<td rowspan="2" class="class-header-space-col"></td>
|
55
|
+
<td rowspan="2">
|
56
|
+
<a class="in-url" href="../../../files/lib/rio/doc/SYNOPSIS_rb.html">
|
57
|
+
lib/rio/doc/SYNOPSIS.rb
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</td>
|
61
|
+
</tr>
|
62
|
+
|
63
|
+
</table>
|
64
|
+
</div>
|
65
|
+
<!-- banner header -->
|
66
|
+
|
67
|
+
<div id="bodyContent">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<div id="contextContent">
|
72
|
+
|
73
|
+
<div id="description">
|
74
|
+
<h1><a href="../Rio.html">Rio</a> - Ruby I/O Comfort Class</h1>
|
75
|
+
<p>
|
76
|
+
<a href="../Rio.html">Rio</a> is a convenience class wrapping much of the
|
77
|
+
functionality of IO, File, Dir, Pathname, FileUtils, Tempfile, StringIO,
|
78
|
+
OpenURI, Zlib, and CSV.
|
79
|
+
</p>
|
80
|
+
<h2><a href="SYNOPSIS.html">SYNOPSIS</a></h2>
|
81
|
+
<p>
|
82
|
+
For the following assume:
|
83
|
+
</p>
|
84
|
+
<pre>
|
85
|
+
astring = ""
|
86
|
+
anarray = []
|
87
|
+
</pre>
|
88
|
+
<p>
|
89
|
+
Copy a file into a string
|
90
|
+
</p>
|
91
|
+
<pre>
|
92
|
+
rio('afile') > astring
|
93
|
+
</pre>
|
94
|
+
<p>
|
95
|
+
Copy the chomped lines of a file into an array
|
96
|
+
</p>
|
97
|
+
<pre>
|
98
|
+
rio('afile').chomp > anarray
|
99
|
+
</pre>
|
100
|
+
<p>
|
101
|
+
Copy a file into another file
|
102
|
+
</p>
|
103
|
+
<pre>
|
104
|
+
rio('afile') > rio('another_file')
|
105
|
+
</pre>
|
106
|
+
<p>
|
107
|
+
Copy a file into a directory
|
108
|
+
</p>
|
109
|
+
<pre>
|
110
|
+
rio('afile') > rio('adir')
|
111
|
+
</pre>
|
112
|
+
<p>
|
113
|
+
Copy an entire directory structure into another directory
|
114
|
+
</p>
|
115
|
+
<pre>
|
116
|
+
rio('adir') > rio('another_directory')
|
117
|
+
</pre>
|
118
|
+
<p>
|
119
|
+
Copy a web page into a file
|
120
|
+
</p>
|
121
|
+
<pre>
|
122
|
+
rio('http://rubydoc.org/') > rio('afile')
|
123
|
+
</pre>
|
124
|
+
<p>
|
125
|
+
Copy a file from a ftp server into a file
|
126
|
+
</p>
|
127
|
+
<pre>
|
128
|
+
rio('ftp://host/afile.gz') > rio('afile.gz')
|
129
|
+
</pre>
|
130
|
+
<p>
|
131
|
+
Copy a gzipped file un-gzipping it
|
132
|
+
</p>
|
133
|
+
<pre>
|
134
|
+
rio('afile.gz').gzip > rio('afile')
|
135
|
+
</pre>
|
136
|
+
<p>
|
137
|
+
Copy a file from a ftp server into a local file un-gzipping it
|
138
|
+
</p>
|
139
|
+
<pre>
|
140
|
+
rio('ftp://host/afile.gz').gzip > rio('afile')
|
141
|
+
</pre>
|
142
|
+
<p>
|
143
|
+
Copy a plain file, gzipping it
|
144
|
+
</p>
|
145
|
+
<pre>
|
146
|
+
rio('afile.gz').gzip < rio('afile')
|
147
|
+
</pre>
|
148
|
+
<p>
|
149
|
+
Iterate over the entries in a directory
|
150
|
+
</p>
|
151
|
+
<pre>
|
152
|
+
rio('adir').entries { |entrio| ... }
|
153
|
+
</pre>
|
154
|
+
<p>
|
155
|
+
Iterate over only the files in a directory
|
156
|
+
</p>
|
157
|
+
<pre>
|
158
|
+
rio('adir').files { |entrio| ... }
|
159
|
+
</pre>
|
160
|
+
<p>
|
161
|
+
Iterate over only the .rb files in a directory
|
162
|
+
</p>
|
163
|
+
<pre>
|
164
|
+
rio('adir').files('*.rb') { |entrio| ... }
|
165
|
+
</pre>
|
166
|
+
<p>
|
167
|
+
Create an array of the .rb entries in a directory
|
168
|
+
</p>
|
169
|
+
<pre>
|
170
|
+
anarray = rio('adir')['*.rb']
|
171
|
+
</pre>
|
172
|
+
<p>
|
173
|
+
Iterate over the .rb files in a directory and its subdirectories
|
174
|
+
</p>
|
175
|
+
<pre>
|
176
|
+
rio('adir').all.files('*.rb') { |entrio| ... }
|
177
|
+
</pre>
|
178
|
+
<p>
|
179
|
+
Create an array of the .rb entries in a directory and its subdirectories
|
180
|
+
</p>
|
181
|
+
<pre>
|
182
|
+
anarray = rio('adir').all['*.rb']
|
183
|
+
</pre>
|
184
|
+
<p>
|
185
|
+
Create an array of the .rb files in a directory and its subdirectories
|
186
|
+
</p>
|
187
|
+
<pre>
|
188
|
+
anarray = rio('adir').all.files['*.rb']
|
189
|
+
</pre>
|
190
|
+
<p>
|
191
|
+
Copy an entire directory structure but only the .rb files from a directory
|
192
|
+
and its subdirectories into another directory
|
193
|
+
</p>
|
194
|
+
<pre>
|
195
|
+
rio('adir').dirs.files('*.rb') > rio('another_directory')
|
196
|
+
</pre>
|
197
|
+
<p>
|
198
|
+
Iterate over the chomped lines of a file
|
199
|
+
</p>
|
200
|
+
<pre>
|
201
|
+
rio('afile').chomp.lines { |line| ... }
|
202
|
+
</pre>
|
203
|
+
<p>
|
204
|
+
Put the chomped lines of a file into an array
|
205
|
+
</p>
|
206
|
+
<pre>
|
207
|
+
anarray = rio('afile').chomp.lines[]
|
208
|
+
</pre>
|
209
|
+
<p>
|
210
|
+
Iterate over the first 10 chomped lines of a file
|
211
|
+
</p>
|
212
|
+
<pre>
|
213
|
+
rio('afile').chomp.lines(0..9) { |line| ... }
|
214
|
+
</pre>
|
215
|
+
<p>
|
216
|
+
Put the first 10 chomped lines of a file into an array
|
217
|
+
</p>
|
218
|
+
<pre>
|
219
|
+
anarray = rio('afile').chomp.lines[0..9]
|
220
|
+
</pre>
|
221
|
+
<p>
|
222
|
+
Copy the first 10 lines of a file into another file
|
223
|
+
</p>
|
224
|
+
<pre>
|
225
|
+
rio('afile').lines(0..9) > rio('another_file')
|
226
|
+
</pre>
|
227
|
+
<p>
|
228
|
+
Copy the first 10 lines of a file to stdout
|
229
|
+
</p>
|
230
|
+
<pre>
|
231
|
+
rio('afile').lines(0..9) > rio(?-)
|
232
|
+
</pre>
|
233
|
+
<p>
|
234
|
+
Copy the first 10 lines of a gzipped file to stdout
|
235
|
+
</p>
|
236
|
+
<pre>
|
237
|
+
rio('afile.gz').gzip.lines(0..9) > rio(?-)
|
238
|
+
</pre>
|
239
|
+
<p>
|
240
|
+
Copy the first 10 lines of a gzipped file on an ftp server to stdout
|
241
|
+
</p>
|
242
|
+
<pre>
|
243
|
+
rio('ftp://host/afile.gz').gzip.lines(0..9) > rio(?-)
|
244
|
+
</pre>
|
245
|
+
<p>
|
246
|
+
Put the first 100 chomped lines of a gzipped file into an array
|
247
|
+
</p>
|
248
|
+
<pre>
|
249
|
+
anarray = rio('afile.gz').gzip[0...100]
|
250
|
+
</pre>
|
251
|
+
<p>
|
252
|
+
Copy the output of th ps command into an array, skipping the header line
|
253
|
+
and the ps command entry
|
254
|
+
</p>
|
255
|
+
<pre>
|
256
|
+
rio(?-,'ps -a').nolines(0,/ps$/) > anarray
|
257
|
+
</pre>
|
258
|
+
<p>
|
259
|
+
Prompt for input and return what was typed
|
260
|
+
</p>
|
261
|
+
<pre>
|
262
|
+
ans = rio(?-).print("Type Something: ").chomp.gets
|
263
|
+
</pre>
|
264
|
+
<p>
|
265
|
+
Change the extension of all files with the extension ’.htm’ in
|
266
|
+
a directory and its subdirectories to have the extension
|
267
|
+
’.html’
|
268
|
+
</p>
|
269
|
+
<pre>
|
270
|
+
rio('adir').rename.all.files('*.htm') do |htmfile|
|
271
|
+
htmfile.extname = '.html'
|
272
|
+
end
|
273
|
+
</pre>
|
274
|
+
<p>
|
275
|
+
Create a symbolic link ‘asymlink’ in ‘adir’ which
|
276
|
+
refers to ‘adir/afile‘
|
277
|
+
</p>
|
278
|
+
<pre>
|
279
|
+
rio('adir/afile').symlinke('adir/asymlink')
|
280
|
+
</pre>
|
281
|
+
<h3>SUGGESTED READING</h3>
|
282
|
+
<ul>
|
283
|
+
<li><a href="INTRO.html">RIO::Doc::INTRO</a>
|
284
|
+
|
285
|
+
</li>
|
286
|
+
<li><a href="HOWTO.html">RIO::Doc::HOWTO</a>
|
287
|
+
|
288
|
+
</li>
|
289
|
+
<li><a href="../Rio.html">RIO::Rio</a>
|
290
|
+
|
291
|
+
</li>
|
292
|
+
</ul>
|
293
|
+
|
294
|
+
</div>
|
295
|
+
|
296
|
+
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
</div>
|
301
|
+
|
302
|
+
|
303
|
+
<!-- if includes -->
|
304
|
+
|
305
|
+
<div id="section">
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
<!-- if method_list -->
|
315
|
+
|
316
|
+
|
317
|
+
</div>
|
318
|
+
|
319
|
+
|
320
|
+
<div id="validator-badges">
|
321
|
+
<p><small>Copyright © 2005 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
|
322
|
+
</div>
|
323
|
+
|
324
|
+
</body>
|
325
|
+
</html>
|