rio 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. data/ChangeLog +49 -0
  2. data/VERSION +1 -1
  3. data/doc/ANNOUNCE +19 -2
  4. data/doc/RELEASE_NOTES +17 -0
  5. data/ex/colx.rb +3 -1
  6. data/ex/passwd_report.rb +12 -0
  7. data/lib/rio.rb +8 -9
  8. data/lib/rio/argv.rb +0 -4
  9. data/lib/rio/base.rb +3 -1
  10. data/lib/rio/doc/INTRO.rb +74 -1
  11. data/lib/rio/ext/csv.rb +34 -5
  12. data/lib/rio/factory.rb +2 -2
  13. data/lib/rio/if.rb +3 -0
  14. data/lib/rio/if/csv.rb +76 -0
  15. data/lib/rio/if/dir.rb +14 -6
  16. data/lib/rio/if/fileordir.rb +6 -0
  17. data/lib/rio/if/grande.rb +28 -0
  18. data/lib/rio/if/internal.rb +75 -2
  19. data/lib/rio/if/methods.rb +4 -3
  20. data/lib/rio/if/string.rb +46 -0
  21. data/lib/rio/if/temp.rb +46 -0
  22. data/lib/rio/matchcolumns.rb +266 -0
  23. data/lib/rio/rangemath.rb +44 -0
  24. data/lib/rio/scheme/temp.rb +4 -1
  25. data/lib/rio/version.rb +1 -1
  26. data/test/tc/all.rb +4 -1
  27. data/test/tc/copy-from.rb +1 -1
  28. data/test/tc/csv2.rb +135 -0
  29. data/test/tc/csv_columns.rb +37 -0
  30. data/test/tc/csvutil.rb +56 -0
  31. data/test/tc/ext.rb +1 -1
  32. data/test/tc/methods.rb +1 -1
  33. data/test/tc/tempfile.rb +17 -0
  34. metadata +11 -228
  35. data/doc/rdoc/classes/Kernel.html +0 -181
  36. data/doc/rdoc/classes/Kernel.src/M000182.html +0 -18
  37. data/doc/rdoc/classes/RIO.html +0 -543
  38. data/doc/rdoc/classes/RIO.src/M000001.html +0 -18
  39. data/doc/rdoc/classes/RIO.src/M000002.html +0 -18
  40. data/doc/rdoc/classes/RIO.src/M000003.html +0 -18
  41. data/doc/rdoc/classes/RIO/Doc.html +0 -138
  42. data/doc/rdoc/classes/RIO/Doc/HOWTO.html +0 -1035
  43. data/doc/rdoc/classes/RIO/Doc/INTRO.html +0 -1335
  44. data/doc/rdoc/classes/RIO/Doc/MISC.html +0 -443
  45. data/doc/rdoc/classes/RIO/Doc/SYNOPSIS.html +0 -355
  46. data/doc/rdoc/classes/RIO/Rio.html +0 -6358
  47. data/doc/rdoc/classes/RIO/Rio.src/M000004.html +0 -18
  48. data/doc/rdoc/classes/RIO/Rio.src/M000005.html +0 -20
  49. data/doc/rdoc/classes/RIO/Rio.src/M000006.html +0 -27
  50. data/doc/rdoc/classes/RIO/Rio.src/M000007.html +0 -27
  51. data/doc/rdoc/classes/RIO/Rio.src/M000008.html +0 -16
  52. data/doc/rdoc/classes/RIO/Rio.src/M000009.html +0 -18
  53. data/doc/rdoc/classes/RIO/Rio.src/M000010.html +0 -20
  54. data/doc/rdoc/classes/RIO/Rio.src/M000011.html +0 -16
  55. data/doc/rdoc/classes/RIO/Rio.src/M000012.html +0 -16
  56. data/doc/rdoc/classes/RIO/Rio.src/M000013.html +0 -16
  57. data/doc/rdoc/classes/RIO/Rio.src/M000014.html +0 -16
  58. data/doc/rdoc/classes/RIO/Rio.src/M000015.html +0 -16
  59. data/doc/rdoc/classes/RIO/Rio.src/M000016.html +0 -16
  60. data/doc/rdoc/classes/RIO/Rio.src/M000017.html +0 -16
  61. data/doc/rdoc/classes/RIO/Rio.src/M000018.html +0 -16
  62. data/doc/rdoc/classes/RIO/Rio.src/M000019.html +0 -16
  63. data/doc/rdoc/classes/RIO/Rio.src/M000020.html +0 -16
  64. data/doc/rdoc/classes/RIO/Rio.src/M000021.html +0 -16
  65. data/doc/rdoc/classes/RIO/Rio.src/M000022.html +0 -16
  66. data/doc/rdoc/classes/RIO/Rio.src/M000023.html +0 -16
  67. data/doc/rdoc/classes/RIO/Rio.src/M000024.html +0 -16
  68. data/doc/rdoc/classes/RIO/Rio.src/M000025.html +0 -16
  69. data/doc/rdoc/classes/RIO/Rio.src/M000026.html +0 -16
  70. data/doc/rdoc/classes/RIO/Rio.src/M000027.html +0 -16
  71. data/doc/rdoc/classes/RIO/Rio.src/M000028.html +0 -16
  72. data/doc/rdoc/classes/RIO/Rio.src/M000029.html +0 -16
  73. data/doc/rdoc/classes/RIO/Rio.src/M000030.html +0 -16
  74. data/doc/rdoc/classes/RIO/Rio.src/M000031.html +0 -16
  75. data/doc/rdoc/classes/RIO/Rio.src/M000032.html +0 -16
  76. data/doc/rdoc/classes/RIO/Rio.src/M000033.html +0 -16
  77. data/doc/rdoc/classes/RIO/Rio.src/M000034.html +0 -16
  78. data/doc/rdoc/classes/RIO/Rio.src/M000035.html +0 -16
  79. data/doc/rdoc/classes/RIO/Rio.src/M000036.html +0 -16
  80. data/doc/rdoc/classes/RIO/Rio.src/M000037.html +0 -16
  81. data/doc/rdoc/classes/RIO/Rio.src/M000038.html +0 -16
  82. data/doc/rdoc/classes/RIO/Rio.src/M000039.html +0 -16
  83. data/doc/rdoc/classes/RIO/Rio.src/M000040.html +0 -16
  84. data/doc/rdoc/classes/RIO/Rio.src/M000041.html +0 -16
  85. data/doc/rdoc/classes/RIO/Rio.src/M000042.html +0 -16
  86. data/doc/rdoc/classes/RIO/Rio.src/M000043.html +0 -16
  87. data/doc/rdoc/classes/RIO/Rio.src/M000044.html +0 -16
  88. data/doc/rdoc/classes/RIO/Rio.src/M000045.html +0 -16
  89. data/doc/rdoc/classes/RIO/Rio.src/M000046.html +0 -16
  90. data/doc/rdoc/classes/RIO/Rio.src/M000047.html +0 -16
  91. data/doc/rdoc/classes/RIO/Rio.src/M000048.html +0 -16
  92. data/doc/rdoc/classes/RIO/Rio.src/M000049.html +0 -16
  93. data/doc/rdoc/classes/RIO/Rio.src/M000050.html +0 -16
  94. data/doc/rdoc/classes/RIO/Rio.src/M000051.html +0 -16
  95. data/doc/rdoc/classes/RIO/Rio.src/M000052.html +0 -16
  96. data/doc/rdoc/classes/RIO/Rio.src/M000053.html +0 -16
  97. data/doc/rdoc/classes/RIO/Rio.src/M000054.html +0 -16
  98. data/doc/rdoc/classes/RIO/Rio.src/M000055.html +0 -16
  99. data/doc/rdoc/classes/RIO/Rio.src/M000056.html +0 -16
  100. data/doc/rdoc/classes/RIO/Rio.src/M000057.html +0 -16
  101. data/doc/rdoc/classes/RIO/Rio.src/M000058.html +0 -16
  102. data/doc/rdoc/classes/RIO/Rio.src/M000059.html +0 -16
  103. data/doc/rdoc/classes/RIO/Rio.src/M000060.html +0 -16
  104. data/doc/rdoc/classes/RIO/Rio.src/M000061.html +0 -16
  105. data/doc/rdoc/classes/RIO/Rio.src/M000062.html +0 -16
  106. data/doc/rdoc/classes/RIO/Rio.src/M000063.html +0 -16
  107. data/doc/rdoc/classes/RIO/Rio.src/M000064.html +0 -16
  108. data/doc/rdoc/classes/RIO/Rio.src/M000065.html +0 -16
  109. data/doc/rdoc/classes/RIO/Rio.src/M000066.html +0 -16
  110. data/doc/rdoc/classes/RIO/Rio.src/M000067.html +0 -16
  111. data/doc/rdoc/classes/RIO/Rio.src/M000068.html +0 -16
  112. data/doc/rdoc/classes/RIO/Rio.src/M000069.html +0 -16
  113. data/doc/rdoc/classes/RIO/Rio.src/M000070.html +0 -16
  114. data/doc/rdoc/classes/RIO/Rio.src/M000071.html +0 -16
  115. data/doc/rdoc/classes/RIO/Rio.src/M000072.html +0 -16
  116. data/doc/rdoc/classes/RIO/Rio.src/M000073.html +0 -16
  117. data/doc/rdoc/classes/RIO/Rio.src/M000074.html +0 -16
  118. data/doc/rdoc/classes/RIO/Rio.src/M000075.html +0 -16
  119. data/doc/rdoc/classes/RIO/Rio.src/M000076.html +0 -16
  120. data/doc/rdoc/classes/RIO/Rio.src/M000077.html +0 -16
  121. data/doc/rdoc/classes/RIO/Rio.src/M000078.html +0 -16
  122. data/doc/rdoc/classes/RIO/Rio.src/M000079.html +0 -16
  123. data/doc/rdoc/classes/RIO/Rio.src/M000080.html +0 -16
  124. data/doc/rdoc/classes/RIO/Rio.src/M000081.html +0 -16
  125. data/doc/rdoc/classes/RIO/Rio.src/M000082.html +0 -16
  126. data/doc/rdoc/classes/RIO/Rio.src/M000083.html +0 -16
  127. data/doc/rdoc/classes/RIO/Rio.src/M000084.html +0 -16
  128. data/doc/rdoc/classes/RIO/Rio.src/M000085.html +0 -16
  129. data/doc/rdoc/classes/RIO/Rio.src/M000086.html +0 -16
  130. data/doc/rdoc/classes/RIO/Rio.src/M000087.html +0 -16
  131. data/doc/rdoc/classes/RIO/Rio.src/M000088.html +0 -16
  132. data/doc/rdoc/classes/RIO/Rio.src/M000089.html +0 -16
  133. data/doc/rdoc/classes/RIO/Rio.src/M000090.html +0 -16
  134. data/doc/rdoc/classes/RIO/Rio.src/M000091.html +0 -16
  135. data/doc/rdoc/classes/RIO/Rio.src/M000092.html +0 -16
  136. data/doc/rdoc/classes/RIO/Rio.src/M000093.html +0 -16
  137. data/doc/rdoc/classes/RIO/Rio.src/M000094.html +0 -16
  138. data/doc/rdoc/classes/RIO/Rio.src/M000095.html +0 -16
  139. data/doc/rdoc/classes/RIO/Rio.src/M000096.html +0 -16
  140. data/doc/rdoc/classes/RIO/Rio.src/M000097.html +0 -16
  141. data/doc/rdoc/classes/RIO/Rio.src/M000098.html +0 -16
  142. data/doc/rdoc/classes/RIO/Rio.src/M000099.html +0 -16
  143. data/doc/rdoc/classes/RIO/Rio.src/M000100.html +0 -16
  144. data/doc/rdoc/classes/RIO/Rio.src/M000101.html +0 -16
  145. data/doc/rdoc/classes/RIO/Rio.src/M000102.html +0 -16
  146. data/doc/rdoc/classes/RIO/Rio.src/M000103.html +0 -16
  147. data/doc/rdoc/classes/RIO/Rio.src/M000104.html +0 -16
  148. data/doc/rdoc/classes/RIO/Rio.src/M000105.html +0 -16
  149. data/doc/rdoc/classes/RIO/Rio.src/M000106.html +0 -16
  150. data/doc/rdoc/classes/RIO/Rio.src/M000107.html +0 -16
  151. data/doc/rdoc/classes/RIO/Rio.src/M000108.html +0 -16
  152. data/doc/rdoc/classes/RIO/Rio.src/M000109.html +0 -16
  153. data/doc/rdoc/classes/RIO/Rio.src/M000110.html +0 -16
  154. data/doc/rdoc/classes/RIO/Rio.src/M000111.html +0 -16
  155. data/doc/rdoc/classes/RIO/Rio.src/M000112.html +0 -16
  156. data/doc/rdoc/classes/RIO/Rio.src/M000113.html +0 -16
  157. data/doc/rdoc/classes/RIO/Rio.src/M000114.html +0 -16
  158. data/doc/rdoc/classes/RIO/Rio.src/M000115.html +0 -16
  159. data/doc/rdoc/classes/RIO/Rio.src/M000116.html +0 -16
  160. data/doc/rdoc/classes/RIO/Rio.src/M000117.html +0 -16
  161. data/doc/rdoc/classes/RIO/Rio.src/M000118.html +0 -16
  162. data/doc/rdoc/classes/RIO/Rio.src/M000119.html +0 -16
  163. data/doc/rdoc/classes/RIO/Rio.src/M000120.html +0 -16
  164. data/doc/rdoc/classes/RIO/Rio.src/M000121.html +0 -16
  165. data/doc/rdoc/classes/RIO/Rio.src/M000122.html +0 -16
  166. data/doc/rdoc/classes/RIO/Rio.src/M000123.html +0 -16
  167. data/doc/rdoc/classes/RIO/Rio.src/M000124.html +0 -16
  168. data/doc/rdoc/classes/RIO/Rio.src/M000125.html +0 -16
  169. data/doc/rdoc/classes/RIO/Rio.src/M000126.html +0 -16
  170. data/doc/rdoc/classes/RIO/Rio.src/M000127.html +0 -16
  171. data/doc/rdoc/classes/RIO/Rio.src/M000128.html +0 -16
  172. data/doc/rdoc/classes/RIO/Rio.src/M000129.html +0 -16
  173. data/doc/rdoc/classes/RIO/Rio.src/M000130.html +0 -16
  174. data/doc/rdoc/classes/RIO/Rio.src/M000131.html +0 -16
  175. data/doc/rdoc/classes/RIO/Rio.src/M000132.html +0 -16
  176. data/doc/rdoc/classes/RIO/Rio.src/M000133.html +0 -16
  177. data/doc/rdoc/classes/RIO/Rio.src/M000134.html +0 -16
  178. data/doc/rdoc/classes/RIO/Rio.src/M000135.html +0 -16
  179. data/doc/rdoc/classes/RIO/Rio.src/M000136.html +0 -16
  180. data/doc/rdoc/classes/RIO/Rio.src/M000137.html +0 -16
  181. data/doc/rdoc/classes/RIO/Rio.src/M000138.html +0 -16
  182. data/doc/rdoc/classes/RIO/Rio.src/M000139.html +0 -16
  183. data/doc/rdoc/classes/RIO/Rio.src/M000140.html +0 -16
  184. data/doc/rdoc/classes/RIO/Rio.src/M000141.html +0 -16
  185. data/doc/rdoc/classes/RIO/Rio.src/M000142.html +0 -16
  186. data/doc/rdoc/classes/RIO/Rio.src/M000143.html +0 -16
  187. data/doc/rdoc/classes/RIO/Rio.src/M000144.html +0 -16
  188. data/doc/rdoc/classes/RIO/Rio.src/M000145.html +0 -16
  189. data/doc/rdoc/classes/RIO/Rio.src/M000146.html +0 -16
  190. data/doc/rdoc/classes/RIO/Rio.src/M000147.html +0 -16
  191. data/doc/rdoc/classes/RIO/Rio.src/M000148.html +0 -16
  192. data/doc/rdoc/classes/RIO/Rio.src/M000149.html +0 -16
  193. data/doc/rdoc/classes/RIO/Rio.src/M000150.html +0 -16
  194. data/doc/rdoc/classes/RIO/Rio.src/M000151.html +0 -16
  195. data/doc/rdoc/classes/RIO/Rio.src/M000152.html +0 -16
  196. data/doc/rdoc/classes/RIO/Rio.src/M000153.html +0 -16
  197. data/doc/rdoc/classes/RIO/Rio.src/M000154.html +0 -16
  198. data/doc/rdoc/classes/RIO/Rio.src/M000155.html +0 -16
  199. data/doc/rdoc/classes/RIO/Rio.src/M000156.html +0 -16
  200. data/doc/rdoc/classes/RIO/Rio.src/M000157.html +0 -16
  201. data/doc/rdoc/classes/RIO/Rio.src/M000158.html +0 -16
  202. data/doc/rdoc/classes/RIO/Rio.src/M000159.html +0 -16
  203. data/doc/rdoc/classes/RIO/Rio.src/M000160.html +0 -16
  204. data/doc/rdoc/classes/RIO/Rio.src/M000161.html +0 -16
  205. data/doc/rdoc/classes/RIO/Rio.src/M000162.html +0 -16
  206. data/doc/rdoc/classes/RIO/Rio.src/M000163.html +0 -16
  207. data/doc/rdoc/classes/RIO/Rio.src/M000164.html +0 -16
  208. data/doc/rdoc/classes/RIO/Rio.src/M000165.html +0 -16
  209. data/doc/rdoc/classes/RIO/Rio.src/M000166.html +0 -16
  210. data/doc/rdoc/classes/RIO/Rio.src/M000167.html +0 -16
  211. data/doc/rdoc/classes/RIO/Rio.src/M000168.html +0 -16
  212. data/doc/rdoc/classes/RIO/Rio.src/M000169.html +0 -16
  213. data/doc/rdoc/classes/RIO/Rio.src/M000170.html +0 -16
  214. data/doc/rdoc/classes/RIO/Rio.src/M000171.html +0 -16
  215. data/doc/rdoc/classes/RIO/Rio.src/M000172.html +0 -16
  216. data/doc/rdoc/classes/RIO/Rio.src/M000173.html +0 -16
  217. data/doc/rdoc/classes/RIO/Rio.src/M000174.html +0 -16
  218. data/doc/rdoc/classes/RIO/Rio.src/M000175.html +0 -16
  219. data/doc/rdoc/classes/RIO/Rio.src/M000176.html +0 -16
  220. data/doc/rdoc/classes/RIO/Rio.src/M000177.html +0 -16
  221. data/doc/rdoc/classes/RIO/Rio.src/M000178.html +0 -16
  222. data/doc/rdoc/classes/RIO/Rio.src/M000179.html +0 -16
  223. data/doc/rdoc/classes/RIO/Rio.src/M000180.html +0 -16
  224. data/doc/rdoc/classes/RIO/Rio.src/M000181.html +0 -16
  225. data/doc/rdoc/created.rid +0 -1
  226. data/doc/rdoc/files/README.html +0 -215
  227. data/doc/rdoc/files/lib/rio/constructor_rb.html +0 -142
  228. data/doc/rdoc/files/lib/rio/doc/HOWTO_rb.html +0 -135
  229. data/doc/rdoc/files/lib/rio/doc/INTRO_rb.html +0 -135
  230. data/doc/rdoc/files/lib/rio/doc/MISC_rb.html +0 -135
  231. data/doc/rdoc/files/lib/rio/doc/SYNOPSIS_rb.html +0 -135
  232. data/doc/rdoc/files/lib/rio/if/basic_rb.html +0 -135
  233. data/doc/rdoc/files/lib/rio/if/dir_rb.html +0 -135
  234. data/doc/rdoc/files/lib/rio/if/file_rb.html +0 -135
  235. data/doc/rdoc/files/lib/rio/if/fileordir_rb.html +0 -135
  236. data/doc/rdoc/files/lib/rio/if/grande_rb.html +0 -135
  237. data/doc/rdoc/files/lib/rio/if/internal_rb.html +0 -135
  238. data/doc/rdoc/files/lib/rio/if/methods_rb.html +0 -135
  239. data/doc/rdoc/files/lib/rio/if/path_rb.html +0 -135
  240. data/doc/rdoc/files/lib/rio/if/stream_rb.html +0 -135
  241. data/doc/rdoc/files/lib/rio/if/test_rb.html +0 -135
  242. data/doc/rdoc/files/lib/rio/kernel_rb.html +0 -142
  243. data/doc/rdoc/files/lib/rio_rb.html +0 -153
  244. data/doc/rdoc/fr_class_index.html +0 -34
  245. data/doc/rdoc/fr_file_index.html +0 -44
  246. data/doc/rdoc/fr_method_index.html +0 -209
  247. data/doc/rdoc/index.html +0 -24
  248. data/doc/rdoc/rdoc-style.css +0 -384
@@ -1,18 +0,0 @@
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>
7
- <head>
8
- <title>rio (RIO)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/rio/constructor.rb, line 170</span>
14
- 170: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rio</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-comment cmt"># :yields: self</span>
15
- 171: <span class="ruby-constant">Rio</span>.<span class="ruby-identifier">rio</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
16
- 172: <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,18 +0,0 @@
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>
7
- <head>
8
- <title>cwd (RIO)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/rio/constructor.rb, line 177</span>
14
- 177: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cwd</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-comment cmt"># :yields: self</span>
15
- 178: <span class="ruby-constant">Rio</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">getwd</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
16
- 179: <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,18 +0,0 @@
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>
7
- <head>
8
- <title>root (RIO)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/rio/constructor.rb, line 184</span>
14
- 184: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">root</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-comment cmt"># :yields: self</span>
15
- 185: <span class="ruby-constant">Rio</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">rootpath</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
16
- 186: <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,138 +0,0 @@
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</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</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/HOWTO_rb.html">
57
- lib/rio/doc/HOWTO.rb
58
- </a>
59
- &nbsp;&nbsp;
60
- <a class="in-url" href="../../files/lib/rio/doc/INTRO_rb.html">
61
- lib/rio/doc/INTRO.rb
62
- </a>
63
- &nbsp;&nbsp;
64
- <a class="in-url" href="../../files/lib/rio/doc/MISC_rb.html">
65
- lib/rio/doc/MISC.rb
66
- </a>
67
- &nbsp;&nbsp;
68
- <a class="in-url" href="../../files/lib/rio/doc/SYNOPSIS_rb.html">
69
- lib/rio/doc/SYNOPSIS.rb
70
- </a>
71
- &nbsp;&nbsp;
72
- </td>
73
- </tr>
74
-
75
- </table>
76
- </div>
77
- <!-- banner header -->
78
-
79
- <div id="bodyContent">
80
-
81
-
82
-
83
- <div id="contextContent">
84
-
85
- <div id="description">
86
- <p>
87
- Copyright &#169; 2005, Christopher Kleckner. All rights reserved
88
- </p>
89
- <p>
90
- This file is part of the <a href="Rio.html">Rio</a> library for ruby. <a
91
- href="Rio.html">Rio</a> is free software; you can redistribute it and/or
92
- modify it under the terms of the <a
93
- href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
94
- as published by the Free Software Foundation; either version 2 of the
95
- License, or (at your option) any later version.
96
- </p>
97
-
98
- </div>
99
-
100
-
101
- </div>
102
-
103
-
104
- </div>
105
-
106
-
107
- <!-- if includes -->
108
-
109
- <div id="section">
110
-
111
- <div id="class-list">
112
- <h3 class="section-bar">Classes and Modules</h3>
113
-
114
- Module <a href="Doc/HOWTO.html" class="link">RIO::Doc::HOWTO</a><br />
115
- Module <a href="Doc/INTRO.html" class="link">RIO::Doc::INTRO</a><br />
116
- Module <a href="Doc/MISC.html" class="link">RIO::Doc::MISC</a><br />
117
- Module <a href="Doc/SYNOPSIS.html" class="link">RIO::Doc::SYNOPSIS</a><br />
118
-
119
- </div>
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
- <!-- if method_list -->
128
-
129
-
130
- </div>
131
-
132
-
133
- <div id="validator-badges">
134
- <p><small>Copyright &copy; 2005 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
135
- </div>
136
-
137
- </body>
138
- </html>
@@ -1,1035 +0,0 @@
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::HOWTO</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::HOWTO</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/HOWTO_rb.html">
57
- lib/rio/doc/HOWTO.rb
58
- </a>
59
- &nbsp;&nbsp;
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="HOWTO.html">HOWTO</a>&#8230;</h2>
81
- <h3>Read a single file</h3>
82
- <pre>
83
- ario = rio('afile')
84
- string = &quot;&quot;
85
- array = []
86
- </pre>
87
- <ul>
88
- <li>Read a file into a string.
89
-
90
- <pre>
91
- # method 1
92
- string = ario.slurp
93
- # method 2
94
- ario &gt; string
95
- </pre>
96
- </li>
97
- <li>Append a file onto a string.
98
-
99
- <pre>
100
- # method 1
101
- ario &gt;&gt; string
102
- # method 2
103
- string += ario.slurp
104
- </pre>
105
- </li>
106
- <li>Read lines of a file into an array
107
-
108
- <pre>
109
- # method 1
110
- array = ario[]
111
- # method 2
112
- ario &gt; array
113
- # method 3
114
- array = ario.to_a
115
- # method 4
116
- array = ario.readlines
117
- </pre>
118
- </li>
119
- <li>Append lines of a file into an array
120
-
121
- <pre>
122
- # method 1
123
- ario &gt;&gt; array
124
- # method 2
125
- array += ario.lines[]
126
- </pre>
127
- </li>
128
- <li>Read the first 10 lines of a file into an array
129
-
130
- <pre>
131
- # method 1
132
- array = ario[0...10]
133
- # method 2
134
- array = ario.lines[0...10]
135
- # method 3
136
- ario.lines(0...10) &gt; array
137
- </pre>
138
- </li>
139
- <li>Read lines of a file into an array, with each line chomped
140
-
141
- <pre>
142
- # method 1
143
- array = ario.chomp[]
144
- # method 2
145
- array = ario.chomp.lines[]
146
- # method 3
147
- ario.chomp &gt; array
148
- </pre>
149
- </li>
150
- <li>Append the first 10 lines of a file into an array, with each line chomped
151
-
152
- <pre>
153
- # method 1
154
- array += ario.chomp.lines[0...10]
155
- # method 2
156
- ario.chomp.lines(0...10) &gt;&gt; array
157
- </pre>
158
- </li>
159
- <li>Read all lines starting with &#8216;require&#8217; into an array, with each
160
- line chomped
161
-
162
- <pre>
163
- # method 1
164
- array = ario.chomp.lines[/^\s*require/]
165
- # method 2
166
- ario.chomp.lines(/^\s*require/) &gt; array
167
- </pre>
168
- </li>
169
- <li>Read a gzipped file into a string
170
-
171
- <pre>
172
- # method 1
173
- rio('afile.gz').gzip &gt; string
174
- # method 2
175
- string = rio('afile.gz').gzip.slurp
176
- </pre>
177
- </li>
178
- <li>Append a gzipped file into a string
179
-
180
- <pre>
181
- # method 1
182
- rio('afile.gz').gzip &gt;&gt; string
183
- # method 2
184
- string += rio('afile.gz').gzip.slurp
185
- </pre>
186
- </li>
187
- <li>Iterate through all the lines of a file
188
-
189
- <pre>
190
- # method 1
191
- rio('afile').lines { |line| ... }
192
- # method 2
193
- rio('afile').each { |line| ... }
194
- # method 3
195
- rio('afile').each_line { |line| ... }
196
- </pre>
197
- </li>
198
- <li>Iterate through the lines of a gzipped file
199
-
200
- <pre>
201
- rio('afile.gz').gzip { |line| ... }
202
- </pre>
203
- </li>
204
- <li>Iterate through all non-empty lines of a gzipped file, with each line
205
- chomped
206
-
207
- <pre>
208
- rio('afile.gz').gzip.chomp.nolines(:empty?) { |line| ... }
209
- </pre>
210
- </li>
211
- <li>Iterate through the first 100 lines of a file
212
-
213
- <pre>
214
- # method 1
215
- rio('afile').lines(0...100) { |line| ... }
216
- </pre>
217
- </li>
218
- <li>Iterate through the first line and all ruby comment lines in a gzipped file
219
-
220
- <pre>
221
- rio('afile.rb.gz').gzip.lines(0,/^\s*#/) { |line| ... }
222
- </pre>
223
- </li>
224
- <li>Iterate through the lines of a ruby file that are neither empty nor
225
- comments, with all lines chomped
226
-
227
- <pre>
228
- rio('afile.rb.gz').chomp.nolines(/^\s*#/,:empty?) { |line| ... }
229
- </pre>
230
- </li>
231
- <li>Read all the comment lines from a ruby file into an array with all lines
232
- chomped
233
-
234
- <pre>
235
- # method 1
236
- array = rio('afile.rb').chomp.lines[/^\s*#/]
237
- # method 2
238
- rio('afile.rb').chomp.lines(/^\s*#/) &gt; array
239
- </pre>
240
- </li>
241
- <li>Read lines of a file into an array, with each line chomped, skipping any
242
- lines longer than 1024 chars
243
-
244
- <pre>
245
- # method 1
246
- ario.chomp.lines(proc{ |line| line.length &lt;= 1024}) &gt; array
247
- # method 2
248
- array = ario.chomp.nolines[proc{ |line| line.length &gt; 1024}]
249
- # method 3
250
- array = ario.chomp.lines(proc{ |line| line.length &lt;= 1024}).to_a
251
- </pre>
252
- </li>
253
- </ul>
254
- <hr size="1"></hr><h3>Write to a single file</h3>
255
- <pre>
256
- ario = rio('afile')
257
- string = &quot;A String\n&quot;
258
- array = [&quot;Line 0\n&quot;,&quot;Line 1\n&quot;]
259
- </pre>
260
- <ul>
261
- <li>Write a string to a file, leaving the <a href="../Rio.html">Rio</a> open
262
-
263
- <pre>
264
- # method 1
265
- ario.puts(string)
266
- # method 2
267
- ario.print(string)
268
- # method 3
269
- ario.noautoclose &lt; string
270
- </pre>
271
- </li>
272
- <li>Write a string to a file and close the file
273
-
274
- <pre>
275
- # method 1
276
- rio('afile') &lt; string
277
- # method 2
278
- ario.print!(string)
279
- # method 3
280
- ario.print(string).close
281
- </pre>
282
- </li>
283
- <li>Append a string to a file, leaving the <a href="../Rio.html">Rio</a> open
284
-
285
- <pre>
286
- # method 1
287
- ario.a.puts(string)
288
- # method 2
289
- ario.a.print(string)
290
- # method 3
291
- ario.noautoclose &lt;&lt; string
292
- </pre>
293
- </li>
294
- <li>Append a string to a file and close the file
295
-
296
- <pre>
297
- # method 1
298
- rio('afile') &lt;&lt; string
299
- # method 2
300
- rio('afile').a.print!(string)
301
- # method 3
302
- rio('afile').a.print(string).close
303
- </pre>
304
- </li>
305
- <li>Write an array to a file, leaving the <a href="../Rio.html">Rio</a> open
306
-
307
- <pre>
308
- # method 1
309
- ario = rio('afile').nocloseoncopy
310
- ario &lt;&lt; array
311
- # method 2
312
- ario.noautoclose &lt; array
313
- </pre>
314
- </li>
315
- <li>Write an array to a file and close the file
316
-
317
- <pre>
318
- # method 1
319
- rio('afile') &lt; array
320
- </pre>
321
- </li>
322
- </ul>
323
- <hr size="1"></hr><h3>Select records</h3>
324
- <pre>
325
- ario = rio('afile')
326
- string = &quot;&quot;
327
- array = []
328
- </pre>
329
- <ul>
330
- <li>Put lines one thru ten and line 100 into an array
331
-
332
- <pre>
333
- # method 1
334
- array = ario[0..9,99]
335
- # method 2
336
- array = ario[0...10,99..99]
337
- # method 3
338
- ario(0..9,99) &gt; array
339
- </pre>
340
- </li>
341
- <li>Put lines one thru ten,line 100 and lines starting with &#8216;zippy&#8217;
342
- into an array
343
-
344
- <pre>
345
- # method 1
346
- array = ario[0..9,99,/^zippy/]
347
- # method 2
348
- array = ario[0...10,99..99,/^zippy/]
349
- # method 3
350
- ario(0..9,99,/^zippy/) &gt; array
351
- </pre>
352
- </li>
353
- <li>Put lines that are longer than 128 bytes into an array
354
-
355
- <pre>
356
- # method 1
357
- array = ario[proc{ |l| l.length &gt; 128}]
358
- # method 2
359
- array = ario.lines[proc{ |l| l.length &gt; 128}]
360
- # method 3
361
- array = ario.nolines[proc{ |l| l.length &lt;= 128}]
362
- </pre>
363
- </li>
364
- <li>Copy all lines that do not start with &#8216;zippy&#8217; into another file
365
-
366
- <pre>
367
- # method 1
368
- ario.nolines(/^zippy/) &gt; rio('another_file')
369
- # method 2
370
- ario.lines.nolines(/^zippy/) &gt; rio('another_file')
371
- # method 3
372
- rio('another_file') &lt; ario.nolines(/^zippy/)
373
- </pre>
374
- </li>
375
- <li>Copy the first 10 lines and lines starting with &#8216;zippy&#8217;, but
376
- exclude any lines longer than 128 bytes
377
-
378
- <pre>
379
- # method 1
380
- ario.lines(0...10,/^zippy/).nolines(proc{ |l| l.length &gt; 128}] &gt; rio('another_file')
381
- # method 2
382
- rio('another_file') &lt; ario.lines(0...10,/^zippy/).nolines(proc{ |l| l.length &gt; 128})
383
- </pre>
384
- </li>
385
- </ul>
386
- <hr size="1"></hr><h3>Select directory entries</h3>
387
- <pre>
388
- ario = rio('adir')
389
- string = &quot;&quot;
390
- array = []
391
- </pre>
392
- <ul>
393
- <li>Put all entries with the extension &#8217;.txt&#8217; into an array
394
-
395
- <pre>
396
- # method 1
397
- array = ario['*.txt']
398
- # method 2
399
- array = ario[/\.txt/]
400
- # method 3
401
- array = ario.entries['*.txt']
402
- </pre>
403
- </li>
404
- <li>Put all files with the extension &#8217;.txt&#8217; into an array
405
-
406
- <pre>
407
- # method 1
408
- array = ario.files['*.txt']
409
- # method 2
410
- array = ario.files[/\.txt/]
411
- # method 3
412
- array = ario.files['*.txt']
413
- </pre>
414
- </li>
415
- <li>Put all entries with the extension &#8217;.txt&#8217; into an array,
416
- including those in subdirectories
417
-
418
- <pre>
419
- # method 1
420
- array = ario.all['*.txt']
421
- # method 2
422
- array = ario.all[/\.txt/]
423
- # method 3
424
- array = ario.all.entries['*.txt']
425
- </pre>
426
- </li>
427
- <li>Put all entries with the extension &#8217;.txt&#8217; into an array,
428
- including those in subdirectories, except those in subdirectories name
429
- &#8217;.svn&#8217;
430
-
431
- <pre>
432
- # method 1
433
- array = ario.norecurse('.svn').all['*.txt']
434
- # method 2
435
- array = ario.norecurse(/^\.svn$/).all[/\.txt/]
436
- # method 3
437
- array = ario.norecurse('.svn').entries['*.txt']
438
- # method 4
439
- array = ario.entries('*.txt').norecurse('.svn').to_a
440
- # method 5
441
- array = ario.norecurse('.svn')['*.txt']
442
- </pre>
443
- </li>
444
- <li>Iterate through ruby files in a directory and subdirectories skipping those
445
- in the &#8217;.svn&#8217;, and &#8216;pkg&#8217; directories
446
-
447
- <pre>
448
- # method 1
449
- is_ruby_exe = proc{ |f| f.executable? and f[0][0] =~ /^#!.+ruby/ }
450
- ario.norecurse('.svn','pkg').files('*.rb',is_ruby_exe) { |f| ... }
451
- # method 2
452
- is_ruby_exe = proc{ |f| f.executable? and f.gets =~ /^#!.+ruby/ }
453
- ario.norecurse('.svn','pkg').files('*.rb',is_ruby_exe) { |f| ... }
454
- </pre>
455
- </li>
456
- <li>Put all files excluding those that are symlinks to files in an array
457
-
458
- <pre>
459
- # method 1
460
- array = ario.nofiles[:symlink?]
461
- # method 2
462
- array = ario.nofiles(:symlink?).files[]
463
- # method 3
464
- array = ario.nofiles(:symlink?).to_a
465
- # method 4
466
- array = ario.files.nofiles[:symlink?]
467
- </pre>
468
- </li>
469
- <li>Put all entries that are not files (or symlinks to files) into an array
470
-
471
- <pre>
472
- # method 1
473
- array = ario.nofiles[]
474
- # method 2
475
- array = ario.nofiles.to_a
476
- </pre>
477
- </li>
478
- <li>Put all entries that are symlinks to files into an array
479
-
480
- <pre>
481
- # method 1
482
- array = ario.files[proc{|f| f.file? and f.symlink?}]
483
- # method 2
484
- array = ario.files(proc{|f| f.file? and f.symlink?}).to_a
485
- </pre>
486
- </li>
487
- <li>Put all directories except those named &#8217;.svn&#8217; into an array
488
-
489
- <pre>
490
- # method 1
491
- array = ario.nodirs['.svn']
492
- # method 2
493
- array = ario.nodirs[/^\.svn/]
494
- # method 3
495
- array = ario.nodirs('.svn').to_a
496
- # method 4
497
- array = ario.nodirs('.svn').dirs[]
498
- # method 5
499
- array = ario.nodirs('.svn')[]
500
- </pre>
501
- </li>
502
- </ul>
503
- <hr size="1"></hr><h3>Read and writing files</h3>
504
- <pre>
505
- ario = rio('afile')
506
- string = &quot;&quot;
507
- array = []
508
- </pre>
509
- <ul>
510
- <li>Copy the contents of one file into another file
511
-
512
- <pre>
513
- # method 1
514
- rio('srcfile') &gt; rio('dstfile')
515
- # method 2
516
- rio('dstfile') &lt; rio('srcfile')
517
- # method 3
518
- rip('dstfile').print!(rio('srcfile').slurp)
519
- </pre>
520
- </li>
521
- <li>Append the contents of one file to another file
522
-
523
- <pre>
524
- # method 1
525
- rio('srcfile') &gt;&gt; rio('dstfile')
526
- # method 2
527
- rio('dstfile') &lt;&lt; rio('srcfile')
528
- # method 3
529
- rip('dstfile').a.print!(rio('srcfile').slurp)
530
- </pre>
531
- </li>
532
- <li>Copy the first 10 lines of one file to another file
533
-
534
- <pre>
535
- # method 1
536
- rio('srcfile').lines(0...10) &gt; rio('dstfile')
537
- # method 2
538
- rio('dstfile') &lt; rio('srcfile').lines(0...10)
539
- # method 3
540
- rio('dstfile') &lt; rio('srcfile').lines[0...10]
541
- </pre>
542
- </li>
543
- <li>Concatenate several files into one
544
-
545
- <pre>
546
- # method 1
547
- rio('dstfile') &lt; [ rio('src1'), rio('src2'), rio('src3') ]
548
- # method 2
549
- rio('dstfile') &lt; rio('src1') &lt;&lt; rio('src2') &lt;&lt; rio('src3')
550
- </pre>
551
- </li>
552
- <li>Copy a web page into a file
553
-
554
- <pre>
555
- # method 1
556
- rio('http://ruby-doc.org/') &gt; rio('afile')
557
- # method 2
558
- rio('afile') &lt; rio('http://ruby-doc.org/')
559
- # method 3
560
- rio('afile').print!(rio('http://ruby-doc.org/').slurp)
561
- </pre>
562
- </li>
563
- <li>Append the output of the daytime server running on the localhost to a file
564
-
565
- <pre>
566
- # method 1
567
- rio(&quot;tcp://localhost:daytime&quot;) &gt;&gt; rio('afile')
568
- # method 2
569
- rio(&quot;tcp:&quot;,'localhost','daytime') &gt;&gt; rio('afile')
570
- # method 3
571
- rio('afile') &lt;&lt; rio(&quot;tcp://:daytime&quot;)
572
- # method 4
573
- rio('afile') &lt;&lt; rio(&quot;tcp://:13&quot;)
574
- </pre>
575
- </li>
576
- <li>Copy the first line and all lines containing &#8216;http:&#8217; to a file
577
-
578
- <pre>
579
- # method 1
580
- rio('srcfile').lines(0,/http:/) &gt; rio('dstfile')
581
- # method 2
582
- rio('dstfile') &lt; rio('srcfile').lines(0,/http:/)
583
- # method 3
584
- rio('dstfile') &lt; rio('srcfile').lines[0,/http:/]
585
- # method 4
586
- </pre>
587
- </li>
588
- <li>Create a gzipped copy of a file
589
-
590
- <pre>
591
- # method 1
592
- rio('afile') &gt; rio('afile.gz').gzip
593
- # method 2
594
- rio('afile.gz').gzip &lt; rio('afile')
595
- # method 3
596
- rio('afile.gz').gzip.print!( rio('afile').slurp )
597
- </pre>
598
- </li>
599
- <li>Create an ungzipped copy of a gzipped file
600
-
601
- <pre>
602
- # method 1
603
- rio('afile') &lt; rio('afile.gz').gzip
604
- # method 2
605
- rio('afile.gz').gzip &gt; rio('afile')
606
- # method 3
607
- rio('afile').print!( rio('afile.gz').gzip.slurp )
608
- </pre>
609
- </li>
610
- <li>Copy the first 100 lines of gzipped file on a webserver into a local file
611
-
612
- <pre>
613
- # method 1
614
- rio('http://aserver/afile.gz').gzip.lines(0...100) &gt; rio('afile')
615
- </pre>
616
- </li>
617
- <li>Create a file composed of a header from another file, the output of the
618
- &#8216;ps&#8217; command, some text and its creation time pulled from the
619
- daytime server running on your localhost
620
-
621
- <pre>
622
- # method 1
623
- rio('out') &lt; [ rio('header'), rio(?-,'ps'), &quot;Created on &quot;, rio('tcp://:daytime') ]
624
- # method 2
625
- rio('out') &lt; rio('header') &lt;&lt; rio(?-,'ps') &lt;&lt; &quot;Created on: &quot; &lt;&lt; rio(&quot;tcp://:daytime&quot;)
626
- </pre>
627
- </li>
628
- </ul>
629
- <hr size="1"></hr><h3>Reading multiple files</h3>
630
- <pre>
631
- ario = rio('adir')
632
- string = &quot;&quot;
633
- array = []
634
- </pre>
635
- <ul>
636
- <li>Count the lines of code in a directory tree of ruby source files
637
-
638
- <pre>
639
- # method 1
640
- cnt = ario.all.files('*.rb').chomp.nolines(/^\s*#/,/^\s*$/).inject(0) { |sum,l| sum += 1 }
641
- # method 2
642
- cnt = ario.all.files('*.rb').chomp.nolines[/^\s*#/,/^\s*$/].size
643
- </pre>
644
- </li>
645
- <li>Concatanate the contents of all .txt files in a directory into an array
646
-
647
- <pre>
648
- # method 1
649
- array = ario.lines.files['*.txt']
650
- # method 2
651
- array = ario.files('*.txt').lines[]
652
- # method 3
653
- ario.files('*.txt').lines &gt; array
654
- </pre>
655
- </li>
656
- <li>Concatanate the first line of all .txt files in a directory into an array
657
-
658
- <pre>
659
- # method 1
660
- array = ario.lines(0).files['*.txt']
661
- # method 2
662
- array = ario.files('*.txt').lines[0]
663
- # method 3
664
- ario.files('*.txt').lines(0) &gt; array
665
- </pre>
666
- </li>
667
- <li>Copy all .txt files (but only their first ten lines) in a directory into
668
- another directiory
669
-
670
- <pre>
671
- # method 1
672
- ario.files('*.txt').lines(0...10) &gt; rio('another_dir')
673
- </pre>
674
- </li>
675
- </ul>
676
- <hr size="1"></hr><h3>Read and write using Standard IO</h3>
677
- <pre>
678
- string = &quot;&quot;
679
- array = []
680
- </pre>
681
- <ul>
682
- <li>Prompt for input and return what was typed
683
-
684
- <pre>
685
- # method 1
686
- ans = rio(?-).chomp.print(&quot;Type Something: &quot;).gets
687
- # method 2
688
- stdio = rio(?-).chomp
689
- ans = stdio.print(&quot;Type Something: &quot;).gets
690
- </pre>
691
- </li>
692
- <li>Create a <a href="../Rio.html">Rio</a> tied to stdin or stdout, depending
693
- on how it is used
694
-
695
- <pre>
696
- stdio = rio(?-)
697
- </pre>
698
- </li>
699
- <li>Create a <a href="../Rio.html">Rio</a> tied to stderr
700
-
701
- <pre>
702
- stderr = rio(?=)
703
- </pre>
704
- </li>
705
- <li>Write a string to stdout
706
-
707
- <pre>
708
- # method 1
709
- rio(?-).puts(&quot;Hello World&quot;)
710
- # method 2
711
- rio(?-) &lt;&lt; &quot;Hello World\n&quot;
712
- # method 3
713
- rio(?-) &lt; &quot;Hello World\n&quot;
714
- </pre>
715
- </li>
716
- <li>Read a string from stdin with the input chomped
717
-
718
- <pre>
719
- # method 1
720
- ans = rio(?-).chomp.gets
721
- # method 2
722
- stdio = rio(?-).chomp
723
- ans = stdio.gets
724
- </pre>
725
- </li>
726
- <li>Read from stdin until end of file with the result going into a string
727
-
728
- <pre>
729
- # method 1
730
- rio(?-) &gt;&gt; string
731
- # method 2
732
- rio(?-) &gt; string
733
- </pre>
734
- </li>
735
- <li>Read from stdin until end of file with the chomped lines going into an
736
- array
737
-
738
- <pre>
739
- # method 1
740
- rio(?-).chomp &gt;&gt; array
741
- # method 2
742
- rio(?-).chomp &gt; array
743
- </pre>
744
- </li>
745
- <li>Read from stdin until end of file with the result going into a file
746
-
747
- <pre>
748
- # method 1
749
- rio(?-) &gt; rio('afile')
750
- # method 2
751
- rio('afile') &lt; rio(?-)
752
- </pre>
753
- </li>
754
- <li>Read from stdin until end of file with the result appended to a file
755
-
756
- <pre>
757
- # method 1
758
- rio(?-) &gt;&gt; rio('afile')
759
- # method 2
760
- rio('afile') &lt;&lt; rio(?-)
761
- </pre>
762
- </li>
763
- <li>Write a message to stderr
764
-
765
- <pre>
766
- # method 1
767
- rio(?=).puts(&quot;Hello Error&quot;)
768
- # method 2
769
- rio(?=) &lt;&lt; &quot;Hello Error\n&quot;
770
- # method 3
771
- rio(?=) &lt; &quot;Hello Error\n&quot;
772
- </pre>
773
- </li>
774
- <li>Dump a file to stdout
775
-
776
- <pre>
777
- # method 1
778
- rio(?-) &lt;&lt; rio('afile')
779
- # method 2
780
- rio('afile') &gt;&gt; rio(?-)
781
- # method 3
782
- rio('afile') &gt; rio(?-)
783
- # method 4
784
- rio(?-) &lt; rio('afile')
785
- # method 5
786
- rio(?-).print(rio('afile').slurp)
787
- </pre>
788
- </li>
789
- <li>Emulate a simplified unix &#8216;head&#8217; command which reads from stdin
790
- and writes the first 10 lines to stdout
791
-
792
- <pre>
793
- # method 1
794
- rio(?-).lines(0..9) &gt; rio(?-)
795
- </pre>
796
- </li>
797
- </ul>
798
- <hr size="1"></hr><h3>Reading and writing from processes as one might do with popen</h3>
799
- <ul>
800
- <li>Read the output of the &#8216;ps&#8217; command into an array without the
801
- header line or the line representing the &#8216;ps&#8217; command itself
802
-
803
- <pre>
804
- ps = rio(?-,'ps -a').nolines[0,/ps$/]
805
- </pre>
806
- </li>
807
- <li>Run an external program, copying its input from one location and its output
808
- from another, and make it look very much like a shell command.
809
-
810
- <pre>
811
- # method 1
812
- ans = &quot;&quot;
813
- cat = rio(?-,'cat').w!
814
- cat &lt;&quot;Hello Kitty\n&quot; &gt;ans
815
- </pre>
816
- </li>
817
- </ul>
818
- <hr size="1"></hr><h3>Renaming and moving files</h3>
819
- <pre>
820
- string = &quot;&quot;
821
- array = []
822
- </pre>
823
- <ul>
824
- <li>Rename the file &#8216;a&#8217; to &#8216;b&#8217;
825
-
826
- <pre>
827
- # method 1
828
- rio('a').rename('b')
829
- # method 2
830
- rio('a').rename.filename = 'b'
831
- </pre>
832
- </li>
833
- <li>Rename a file and leave the <a href="../Rio.html">Rio</a> referencing the
834
- files old name
835
-
836
- <pre>
837
- ario = rio('a')
838
- # method 1
839
- ario.rename('b')
840
- </pre>
841
- </li>
842
- <li>Rename a file and change the <a href="../Rio.html">Rio</a> to reference the
843
- new file name
844
-
845
- <pre>
846
- ario = rio('a')
847
- # method 1
848
- ario.rename!('b')
849
- </pre>
850
- </li>
851
- <li>Rename the file &#8216;index.htm&#8217; to &#8216;index.html&#8216;
852
-
853
- <pre>
854
- # method 1
855
- rio('index.htm').rename('index.html')
856
- # method 2
857
- rio('index.htm').rename.extname = '.html'
858
- </pre>
859
- </li>
860
- <li>Rename the file &#8216;index.html&#8217; to &#8216;welcome.html&#8216;
861
-
862
- <pre>
863
- # method 1
864
- rio('index.html').rename('welecome.html')
865
- # method 2
866
- rio('index.htm').rename.basename = 'welcome'
867
- </pre>
868
- </li>
869
- <li>Move a file from directory &#8216;src&#8217; to directory &#8216;dst&#8217;
870
-
871
- <pre>
872
- # method 1
873
- rio('src/afile').rename('dst/afile')
874
- # method 2
875
- rio('src/afile').rename.dirname = 'dst'
876
- </pre>
877
- </li>
878
- <li>Change a file to have the extension &#8217;.html&#8217; leaving the rest of
879
- it as is
880
-
881
- <pre>
882
- # method 1
883
- ario.rename.extname = '.html'
884
- </pre>
885
- </li>
886
- <li>Change a files basename to &#8216;zippy&#8217; without changing its
887
- extension
888
-
889
- <pre>
890
- # method 1
891
- ario.rename.basename = 'zippy'
892
- </pre>
893
- </li>
894
- <li>Change a file ending with &#8217;.tar.gz&#8217; to end with
895
- &#8217;.tgz&#8217;
896
-
897
- <pre>
898
- # method 1
899
- ario.rename.ext('.tar.gz').extname = '.tgz'
900
- </pre>
901
- </li>
902
- <li>Change the extension of all files with the extension &#8217;.htm&#8217; in
903
- a directory to have the extension &#8217;.html&#8217;
904
-
905
- <pre>
906
- # method 1
907
- rio('adir').rename.files('*.htm') do |htmfile|
908
- htmlfile.extname = '.html'
909
- end
910
- # method 2
911
- rio('adir').files('*.htm') do |htmfile|
912
- htmlfile.rename.extname = '.html'
913
- end
914
- </pre>
915
- </li>
916
- <li>Change the extension of all files with the extension &#8217;.htm&#8217; in
917
- a directory and its subdirectories to have the extension
918
- &#8217;.html&#8217;
919
-
920
- <pre>
921
- # method 1
922
- rio('adir').rename.all.files('*.htm') do |htmfile|
923
- htmfile.extname = '.html'
924
- end
925
- # method 2
926
- rio('adir').all.files('*.htm') do |htmfile|
927
- htmfile.rename.extname = '.html'
928
- end
929
- </pre>
930
- </li>
931
- </ul>
932
- <hr size="1"></hr><h3>Manipulate a <a href="../Rio.html">Rio</a>&#8217;s path</h3>
933
- <pre>
934
- string = &quot;&quot;
935
- array = []
936
- </pre>
937
- <ul>
938
- <li>Create a <a href="../Rio.html">Rio</a> with an additional subdirectory
939
- appended
940
-
941
- <pre>
942
- ap = rio('adir')
943
- # method 1
944
- ap /= 'subdirectory'
945
- # method 2
946
- ap = ap.join('subdirectory')
947
- # method 3
948
- ap = rio(ap,'subdirectory')
949
- # method 4
950
- </pre>
951
- </li>
952
- <li>Create a <a href="../Rio.html">Rio</a> from an array of subdirectories
953
-
954
- <pre>
955
- dirs = ['adir','subdir1','subdir2']
956
- # method 1
957
- ario = rio(dirs)
958
- </pre>
959
- </li>
960
- <li>Create an array of subdirectories from a <a href="../Rio.html">Rio</a>
961
-
962
- <pre>
963
- # method 1
964
- anarray = rio('adir/subdir1/subdir2').split
965
- </pre>
966
- </li>
967
- <li>Append a string to a path
968
-
969
- <pre>
970
- # method 1
971
- ario = rio('apath') + astring
972
- # method 2
973
- ario = rio('apath')
974
- ario += astring
975
- </pre>
976
- </li>
977
- <li>create a directory &#8216;links&#8217; with a symlink pointing to each .rb
978
- file in directory &#8216;lib&#8217; (including subdirectories)
979
-
980
- <pre>
981
- lib = rio('lib')
982
- links = rio('links').delete!.mkdir
983
- lib.all.files(&quot;*.rb&quot;) do |f|
984
- f.symlink( f.dirname.sub(/^#{lib}/,links).mkdir )
985
- end
986
- </pre>
987
- </li>
988
- </ul>
989
- <hr size="2"></hr><p>
990
- Suggested Reading
991
- </p>
992
- <ul>
993
- <li><a href="SYNOPSIS.html">RIO::Doc::SYNOPSIS</a>
994
-
995
- </li>
996
- <li><a href="INTRO.html">RIO::Doc::INTRO</a>
997
-
998
- </li>
999
- <li><a href="../Rio.html">RIO::Rio</a>
1000
-
1001
- </li>
1002
- </ul>
1003
-
1004
- </div>
1005
-
1006
-
1007
- </div>
1008
-
1009
-
1010
- </div>
1011
-
1012
-
1013
- <!-- if includes -->
1014
-
1015
- <div id="section">
1016
-
1017
-
1018
-
1019
-
1020
-
1021
-
1022
-
1023
-
1024
- <!-- if method_list -->
1025
-
1026
-
1027
- </div>
1028
-
1029
-
1030
- <div id="validator-badges">
1031
- <p><small>Copyright &copy; 2005 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
1032
- </div>
1033
-
1034
- </body>
1035
- </html>