rio 0.3.1

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