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,1116 @@
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::INTRO</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::INTRO</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/INTRO_rb.html">
57
+ lib/rio/doc/INTRO.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
+ and OpenURI and uses Zlib, and CSV to extend that functionality using a
79
+ simple consistent interface. Most of the instance methods of IO, File and
80
+ Dir are simply forwarded to the appropriate handle to provide identical
81
+ functionality. <a href="../Rio.html">Rio</a> also provides a
82
+ &quot;grande&quot; interface that allows many application level IO tasks to
83
+ be accomplished in line or two of code.
84
+ </p>
85
+ <p>
86
+ <a href="../Rio.html">Rio</a> functionality can be broadly broken into
87
+ three categories
88
+ </p>
89
+ <ul>
90
+ <li>path manipulation
91
+
92
+ </li>
93
+ <li>file system access
94
+
95
+ </li>
96
+ <li>stream manipulation
97
+
98
+ </li>
99
+ </ul>
100
+ <p>
101
+ Which methods are available to a given <a href="../Rio.html">Rio</a>,
102
+ depends on the underlying object.
103
+ </p>
104
+ <p>
105
+ A <a href="../Rio.html">Rio</a> generally does not need to be opened or
106
+ have its mode specified. Most of <a href="../Rio.html">Rio</a>&#8217;s
107
+ methods simply configure it. When an actual IO operation is specified, <a
108
+ href="../Rio.html">Rio</a> determines how to open it based on the object it
109
+ is opening, the operation it is performing, and the options specified.
110
+ </p>
111
+ <p>
112
+ <a href="../Rio.html">Rio</a> configuration methods return the <a
113
+ href="../Rio.html">Rio</a> for easy chaining and regard the presence of a
114
+ block as an implied <tt>each</tt>.
115
+ </p>
116
+ <h2>Using a <a href="../Rio.html">Rio</a></h2>
117
+ <p>
118
+ Using a <a href="../Rio.html">Rio</a> can be described as having 3 steps:
119
+ </p>
120
+ <ul>
121
+ <li>Creating a <a href="../Rio.html">Rio</a> (using the constructor or as the
122
+ result of one of path manipulation methods)
123
+
124
+ </li>
125
+ <li>Configuring a <a href="../Rio.html">Rio</a>
126
+
127
+ </li>
128
+ <li><a href="../Rio.html">Rio</a> I/O
129
+
130
+ </li>
131
+ </ul>
132
+ <h3>Creating a <a href="../Rio.html">Rio</a></h3>
133
+ <p>
134
+ <a href="../Rio.html">Rio</a> extends <a
135
+ href="../../Kernel.html">Kernel</a> with one function <tt>rio</tt>, its
136
+ constructor. This function is overloaded to create any type of <a
137
+ href="../Rio.html">Rio</a>. <tt>rio</tt> looks at the class and sometimes
138
+ the value of its first argument to create an internal representation of the
139
+ resource specified, additional arguments are used as needed by the resource
140
+ type. The rio constructor does not initiate any io, it does not check for a
141
+ resources existance or type. It neither knows nor cares what can be done
142
+ with this <a href="../Rio.html">Rio</a>. Using methods like +respond_to?+
143
+ are meaningless at best and usually misleading.
144
+ </p>
145
+ <p>
146
+ For purposes of discussion, we divide Rios into two catagories, those that
147
+ have a path and those that don&#8217;t.
148
+ </p>
149
+ <h4>Creating a <a href="../Rio.html">Rio</a> that has a path</h4>
150
+ <p>
151
+ To create a <a href="../Rio.html">Rio</a> that has a path the arguments to
152
+ <tt>rio</tt> may be:
153
+ </p>
154
+ <ul>
155
+ <li>a string representing the entire path. The separator used for Rios is as
156
+ specified in RFC1738 (&#8217;/&#8217;).
157
+
158
+ <pre>
159
+ rio('adir/afile')
160
+ </pre>
161
+ </li>
162
+ <li>a string representing a fully qualified <tt>file</tt> URI as per RFC1738
163
+
164
+ <pre>
165
+ rio('file:///atopleveldir/adir/afile')
166
+ </pre>
167
+ </li>
168
+ <li>a <tt>URI</tt> object representing a <tt>file</tt> or generic <tt>URI</tt>
169
+
170
+ <pre>
171
+ rio(URI('adir/afile'))
172
+ </pre>
173
+ </li>
174
+ <li>the components of a path as separate arguments
175
+
176
+ <pre>
177
+ rio('adir','afile')
178
+ </pre>
179
+ </li>
180
+ <li>the components of a path as an array
181
+
182
+ <pre>
183
+ rio(%w/adir afile/)
184
+ </pre>
185
+ </li>
186
+ <li>another <a href="../Rio.html">Rio</a>
187
+
188
+ <pre>
189
+ another_rio = rio('adir/afile')
190
+ rio(another_rio)
191
+ </pre>
192
+ </li>
193
+ <li>any object whose <tt>to_s</tt> method returns one of the above
194
+
195
+ <pre>
196
+ rio(Pathname.new('apath'))
197
+ </pre>
198
+ </li>
199
+ <li>any combination of the above either as separate arguments or as elements of
200
+ an array,
201
+
202
+ <pre>
203
+ another_rio = rio('dir1/dir2')
204
+ auri = URI('dir4/dir5)
205
+ rio(another_rio,'dir3',auri,'dir6/dir7')
206
+ </pre>
207
+ </li>
208
+ </ul>
209
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to a web page</h5>
210
+ <p>
211
+ To create a <a href="../Rio.html">Rio</a> that refers to a web page the
212
+ arguments to <tt>rio</tt> may be:
213
+ </p>
214
+ <ul>
215
+ <li>a string representing a fully qualified <tt>http</tt> URI
216
+
217
+ <pre>
218
+ rio('http://ruby-doc.org/index.html')
219
+ </pre>
220
+ </li>
221
+ <li>a <tt>URI</tt> object representing a <tt>http</tt> <tt>URI</tt>
222
+
223
+ <pre>
224
+ rio(URI('http://ruby-doc.org/index.html'))
225
+ </pre>
226
+ </li>
227
+ <li>either of the above with additional path elements
228
+
229
+ <pre>
230
+ rio('http://www.ruby-doc.org/','core','classes/Object.html')
231
+ </pre>
232
+ </li>
233
+ </ul>
234
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to a file or directory on a FTP server</h5>
235
+ <p>
236
+ To create a <a href="../Rio.html">Rio</a> that refers to a file on a FTP
237
+ server the arguments to <tt>rio</tt> may be:
238
+ </p>
239
+ <ul>
240
+ <li>a string representing a fully qualified <tt>ftp</tt> URI
241
+
242
+ <pre>
243
+ rio('ftp://user:password@ftp.example.com/afile.tar.gz')
244
+ </pre>
245
+ </li>
246
+ <li>a <tt>URI</tt> object representing a <tt>ftp</tt> <tt>URI</tt>
247
+
248
+ <pre>
249
+ rio(URI('ftp://ftp.example.com/afile.tar.gz'))
250
+ </pre>
251
+ </li>
252
+ <li>either of the above with additional path elements
253
+
254
+ <pre>
255
+ rio('ftp://ftp.gnu.org/pub/gnu','emacs','windows','README')
256
+ </pre>
257
+ </li>
258
+ </ul>
259
+ <h4>Creating Rios that do not have a path</h4>
260
+ <p>
261
+ To create a <a href="../Rio.html">Rio</a> without a path, the first
262
+ argument to <tt>rio</tt> is usually a single character.
263
+ </p>
264
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to a clone of your programs stdin or stdout.</h5>
265
+ <p>
266
+ <tt>rio(?-)</tt> (mnemonic: &#8217;-&#8217; is used by some Unix programs
267
+ to specify stdin or stdout in place of a file)
268
+ </p>
269
+ <p>
270
+ Just as a <a href="../Rio.html">Rio</a> that refers to a file, does not
271
+ know whether that file will be opened for reading or writing until an io
272
+ operation is specified, a +stdio:+ <a href="../Rio.html">Rio</a> does not
273
+ know whether it will connect to stdin or stdout until an io operation is
274
+ specified.
275
+ </p>
276
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to a clone of your programs stderr.</h5>
277
+ <p>
278
+ <tt>rio(?=)</tt> (mnemonic: &#8217;-&#8217; refers to fileno 1, so
279
+ &#8217;=&#8217; refers to fileno 2)
280
+ </p>
281
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to an arbitrary IO object.</h5>
282
+ <pre>
283
+ an_io = ::File.new('afile')
284
+ rio(an_io)
285
+ </pre>
286
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to a file descriptor</h5>
287
+ <p>
288
+ <tt>rio(?#,fd)</tt> (mnemonic: a file descriptor is a number
289
+ &#8217;#&#8217; )
290
+ </p>
291
+ <pre>
292
+ an_io = ::File.new('afile')
293
+ rio(an_io)
294
+ </pre>
295
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to a StringIO object</h5>
296
+ <p>
297
+ <tt>rio(?&quot;)</tt> (mnemonic: &#8217;&quot;&#8217; surrounds strings)
298
+ </p>
299
+ <ul>
300
+ <li>create a <a href="../Rio.html">Rio</a> that refers to its own string
301
+
302
+ </li>
303
+ </ul>
304
+ <pre>
305
+ rio(?&quot;)
306
+ </pre>
307
+ <ul>
308
+ <li>create a <a href="../Rio.html">Rio</a> that refers to a string of your
309
+ choosing
310
+
311
+ </li>
312
+ </ul>
313
+ <pre>
314
+ astring = &quot;&quot;
315
+ rio(?&quot;,&quot;&quot;)
316
+ </pre>
317
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to a Tempfile object</h5>
318
+ <p>
319
+ <tt>rio(??)</tt> (mnemonic: &#8217;?&#8217; you don&#8217;t know its name)
320
+ </p>
321
+ <pre>
322
+ rio(??)
323
+ rio(??,basename='rio',tmpdir=Dir::tmpdir)
324
+ </pre>
325
+ <h5>Creating a <a href="../Rio.html">Rio</a> that refers to an arbitrary TCPSocket</h5>
326
+ <pre>
327
+ rio('tcp:',hostname,port)
328
+ </pre>
329
+ <p>
330
+ or
331
+ </p>
332
+ <pre>
333
+ rio('tcp://hostname:port')
334
+ </pre>
335
+ <h5>Creating a <a href="../Rio.html">Rio</a> that runs an external program and connects to its stdin and stdout</h5>
336
+ <p>
337
+ <tt>rio(?-,cmd)</tt> (mnemonic: &#8217;-&#8217; is used by some Unix
338
+ programs to specify stdin or stdout in place of a file)
339
+ </p>
340
+ <p>
341
+ or
342
+ </p>
343
+ <p>
344
+ <tt>rio(?`,cmd)</tt> (mnemonic: &#8217;`&#8217; (backtick) runs an external
345
+ program in ruby)
346
+ </p>
347
+ <p>
348
+ This is <a href="../Rio.html">Rio</a>&#8217;s interface to IO#popen
349
+ </p>
350
+ <h3>Path Manipulation</h3>
351
+ <p>
352
+ <a href="../Rio.html">Rio</a>&#8217;s path manipulation methods are for the
353
+ most part simply forwarded to the File or URI classes with the return
354
+ values converted to a <a href="../Rio.html">Rio</a>.
355
+ </p>
356
+ <h4>Creating a <a href="../Rio.html">Rio</a> from a <a href="../Rio.html">Rio</a>&#8217;s component parts.</h4>
357
+ <p>
358
+ The <a href="../Rio.html">Rio</a> methods for creating a <a
359
+ href="../Rio.html">Rio</a> from a <a href="../Rio.html">Rio</a>&#8217;s
360
+ component parts are <a href="../Rio.html#M000093">Rio#dirname</a>, <a
361
+ href="../Rio.html#M000095">Rio#filename</a>, <a
362
+ href="../Rio.html#M000092">Rio#basename</a>, and <a
363
+ href="../Rio.html#M000094">Rio#extname</a>. The behavior of <a
364
+ href="../Rio.html#M000092">Rio#basename</a> depends on the setting of the
365
+ <tt>ext</tt> configuration variable and is different from its counterpart
366
+ in the File class. The default value of the <tt>ext</tt> configuration
367
+ variable is the string returned File#extname. The <tt>ext</tt>
368
+ configuration variable can be changed using <a
369
+ href="../Rio.html#M000089">Rio#ext</a> and <a
370
+ href="../Rio.html#M000090">Rio#noext</a> and can be queried using <a
371
+ href="../Rio.html#M000089">Rio#ext</a>?. This value is used by calls to <a
372
+ href="../Rio.html#M000092">Rio#basename</a>.
373
+ </p>
374
+ <p>
375
+ <a href="../Rio.html#M000095">Rio#filename</a> returns the last component
376
+ of a path, and is basically the same as <tt>basename</tt> without
377
+ consideration of an extension. So
378
+ </p>
379
+ <pre>
380
+ rio('afile.txt').basename #=&gt; rio('afile')
381
+ rio('afile.txt').filename #=&gt; rio('afile.txt')
382
+
383
+ ario = rio('afile.tar.gz')
384
+ ario.basename #=&gt; rio('afile.tar')
385
+ ario.ext? #=&gt; &quot;.gz&quot;
386
+ ario.ext('.tar.gz').basename #=&gt; rio('afile')
387
+ ario.ext? #=&gt; &quot;.tar.gz&quot;
388
+ </pre>
389
+ <h4>Changing a path&#8217;s component parts.</h4>
390
+ <p>
391
+ <a href="../Rio.html">Rio</a> also provides methods for changing the
392
+ component parts of its path. They are <a
393
+ href="../Rio.html#M000093">Rio#dirname</a>=, <a
394
+ href="../Rio.html#M000095">Rio#filename</a>=, <a
395
+ href="../Rio.html#M000092">Rio#basename</a>=, and <a
396
+ href="../Rio.html#M000094">Rio#extname</a>=. These methods replace the part
397
+ extracted as described above with their argument.
398
+ </p>
399
+ <pre>
400
+ ario = rio('dirA/dirB/afile.rb')
401
+ ario.dirname = 'dirC' # rio('dirC/afile.rb')
402
+ ario.basename = 'bfile' # rio('dirC/bfile.rb')
403
+ ario.extname = '.txt' # rio('dirC/bfile.txt')
404
+ ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
405
+ </pre>
406
+ <p>
407
+ <a href="../Rio.html">Rio</a> also has a <tt>rename</tt> mode which causes
408
+ each of these to rename the actual file system object as well as changing
409
+ the <a href="../Rio.html">Rio</a>. This is discussed in the section on
410
+ Renaming and Moving.
411
+ </p>
412
+ <h4>Splitting a <a href="../Rio.html">Rio</a></h4>
413
+ <p>
414
+ <a href="../Rio.html#M000101">Rio#split</a> returns an array of Rios, one
415
+ for each path element. (Note that this behavior differs from File#split.)
416
+ </p>
417
+ <pre>
418
+ rio('a/b/c').split #=&gt; [rio('a'),rio('b'),rio('c')]
419
+ </pre>
420
+ <p>
421
+ The array returned is extended with a <tt>to_rio</tt> method, which will
422
+ put the parts back together again.
423
+ </p>
424
+ <pre>
425
+ ary = rio('a/b/c').split #=&gt; [rio('a'),rio('b'),rio('c')]
426
+ ary.to_rio #=&gt; rio('a/b/c')
427
+ </pre>
428
+ <h4>Creating a <a href="../Rio.html">Rio</a> by specifying the individual parts of its path</h4>
429
+ <p>
430
+ The first way to create a <a href="../Rio.html">Rio</a> by specifying its
431
+ parts is to use the <a href="../Rio.html">Rio</a> constructor <a
432
+ href="../Rio.html#M000006">Rio#rio</a>. Since a <a
433
+ href="../Rio.html">Rio</a> is among the arguments the constructor will
434
+ take, the constructor can be used.
435
+ </p>
436
+ <pre>
437
+ ario = rio('adir')
438
+ rio(ario,'b') #=&gt; rio('adir/b')
439
+ </pre>
440
+ <p>
441
+ <a href="../Rio.html#M000100">Rio#join</a> and <a
442
+ href="../Rio.html">Rio</a>#/ do the same thing, but the operator version
443
+ <tt>/</tt> can take only one argument.
444
+ </p>
445
+ <pre>
446
+ a = rio('a')
447
+ b = rio('b')
448
+ c = a.join(b) #=&gt; rio('a/b')
449
+ c = a/b #=&gt; rio('a/b')
450
+ </pre>
451
+ <p>
452
+ The arguments to <tt>join</tt> and <tt>/</tt> do not need to be Rios, of
453
+ course
454
+ </p>
455
+ <pre>
456
+ ario = rio('adir')
457
+ ario/'afile.rb' #=&gt; rio('ario/afile.rb')
458
+ ario.join('b','c','d') #=&gt; rio('ario/b/c/d')
459
+ ario/'b'/'c'/'d' #=&gt; rio('ario/b/c/d')
460
+ ario /= 'e' #=&gt; rio('ario/b/c/d/e')
461
+ </pre>
462
+ <h4>Manipulating a <a href="../Rio.html">Rio</a> path by treating it as a string.</h4>
463
+ <p>
464
+ The <a href="../Rio.html">Rio</a> methods which treat a <a
465
+ href="../Rio.html">Rio</a> as a string are <a
466
+ href="../Rio.html#M000104">Rio#sub</a>, <a
467
+ href="../Rio.html#M000105">Rio#gsub</a> and <a
468
+ href="../Rio.html">Rio</a>#+. These methods create a new <a
469
+ href="../Rio.html">Rio</a> using the string created by forwarding the
470
+ method to the String returned by <a
471
+ href="../Rio.html#M000008">Rio#to_s</a>.
472
+ </p>
473
+ <pre>
474
+ ario = rio('dirA/dirB/afile') + '-1.1.1' # rio('dirA/dirB/afile-1.1.1')
475
+ brio = ario.sub(/^dirA/, 'dirC') # rio('dirC/dirB/afile-1.1.1')
476
+ </pre>
477
+ <h4>Creating a <a href="../Rio.html">Rio</a> based on its relationship to another</h4>
478
+ <p>
479
+ <a href="../Rio.html#M000087">Rio#abs</a> creates a new rio whose path is
480
+ the absolute path of a <a href="../Rio.html">Rio</a>. If provided with an
481
+ argument, it uses that as the base path, otherwise it uses an internal base
482
+ path (usually the current working directory when it was created).
483
+ </p>
484
+ <pre>
485
+ rio('/tmp').chdir do
486
+ rio('a').abs #=&gt; rio('/tmp/a')
487
+ rio('a').abs('/usr') #=&gt; rio('/usr/a')
488
+ end
489
+ </pre>
490
+ <p>
491
+ <a href="../Rio.html#M000088">Rio#rel</a> creates a new rio with a path
492
+ relative to a <a href="../Rio.html">Rio</a>.
493
+ </p>
494
+ <pre>
495
+ rio('/tmp').chdir do
496
+ rio('/tmp/a').rel #=&gt; rio('a')
497
+ end
498
+ rio('/tmp/b').rel('/tmp') #=&gt; rio('b')
499
+ </pre>
500
+ <p>
501
+ <a href="../Rio.html#M000114">Rio#route_to</a> and <a
502
+ href="../Rio.html#M000113">Rio#route_from</a> creates a new rio with a path
503
+ representing the route to get to/from a <a href="../Rio.html">Rio</a>. They
504
+ are based on the methods of the same names in the URI class
505
+ </p>
506
+ <h3>Configuring a <a href="../Rio.html">Rio</a></h3>
507
+ <p>
508
+ The second step in using a rio is configuring it. Note that many times no
509
+ configuration is necessary and that this is not a comprehensive list of all
510
+ of <a href="../Rio.html">Rio</a>&#8217;s configuration methods.
511
+ </p>
512
+ <p>
513
+ <a href="../Rio.html">Rio</a>&#8217;s configuration mehods fall into three
514
+ categories.
515
+ </p>
516
+ <dl>
517
+ <dt>IO manipulators</dt><dd>An IO manipulator alters the behavior of a <a
518
+ href="../Rio.html">Rio</a>&#8217;s underlying IO object. These affect the
519
+ behaviour of I/O methods which are forwarded directly to the underlying
520
+ object as well as the grande I/O methods.
521
+
522
+ </dd>
523
+ <dt>Grande configuration methods</dt><dd>The grande configuration methods affect the behaviour of <a
524
+ href="../Rio.html">Rio</a>&#8217;s grande I/O methods
525
+
526
+ </dd>
527
+ <dt>Grande selection methods</dt><dd>The grande selection methods select what data is returned by <a
528
+ href="../Rio.html">Rio</a>&#8217;s grande I/O methods
529
+
530
+ </dd>
531
+ </dl>
532
+ <p>
533
+ All of <a href="../Rio.html">Rio</a>&#8217;s configuration and selection
534
+ methods can be passed a block, which will cause the <a
535
+ href="../Rio.html">Rio</a> to behave as if <tt>each</tt> had been called
536
+ with the block after the method.
537
+ </p>
538
+ <h4>IO manipulators</h4>
539
+ <ul>
540
+ <li><tt>gzip</tt> a file on output, and ungzip it on input
541
+
542
+ <pre>
543
+ rio('afile.gz').gzip
544
+ </pre>
545
+ <p>
546
+ This causes the rio to read through a Zlib::GzipReader and to write
547
+ Zlib::GzipWriter.
548
+ </p>
549
+ </li>
550
+ <li><tt>chomp</tt> lines as they are read
551
+
552
+ <pre>
553
+ rio('afile').chomp
554
+ </pre>
555
+ <p>
556
+ This causes a <a href="../Rio.html">Rio</a> to call String#chomp on the the
557
+ String returned by all line oriented read operations.
558
+ </p>
559
+ </li>
560
+ </ul>
561
+ <h4>Grande configuration methods</h4>
562
+ <ul>
563
+ <li><tt>all</tt>, <tt>recurse</tt>, <tt>norecurse</tt>
564
+
565
+ <pre>
566
+ rio('adir').all
567
+ rio('adir').norecurse('CVS')
568
+ </pre>
569
+ <p>
570
+ These methods instruct the <a href="../Rio.html">Rio</a> to also include
571
+ entries in subdirectories when iterating through directories and control
572
+ which subdirectories are included or excluded.
573
+ </p>
574
+ </li>
575
+ <li><tt>bytes</tt>
576
+
577
+ <pre>
578
+ rio('afile').bytes(1024)
579
+ </pre>
580
+ <p>
581
+ This causes a <a href="../Rio.html">Rio</a> to read the specified number of
582
+ bytes at a time as a file is iterated through.
583
+ </p>
584
+ </li>
585
+ </ul>
586
+ <h4>Grande selection methods</h4>
587
+ <ul>
588
+ <li><tt>lines</tt>, <tt>nolines</tt>
589
+
590
+ <pre>
591
+ rio('afile').lines(0..9)
592
+ rio('afile').nolines(/^\s*#/)
593
+ </pre>
594
+ <p>
595
+ Strictly speaking these are both configuration and selection methods. They
596
+ configure the <a href="../Rio.html">Rio</a> to iterate through an input
597
+ stream as lines. The arguments select which lines are actually returned.
598
+ Lines are included (<tt>lines</tt>) or excluded (<tt>nolines</tt>) if they
599
+ match <b>any</b> of the arguments as follows.
600
+ </p>
601
+ <p>
602
+ If the argument is a:
603
+ </p>
604
+ <table>
605
+ <tr><td valign="top"><tt>RegExp</tt>:</td><td>the line is matched against it
606
+
607
+ </td></tr>
608
+ <tr><td valign="top"><tt>Range</tt>:</td><td>the lineno is matched against it
609
+
610
+ </td></tr>
611
+ <tr><td valign="top"><tt>Integer</tt>:</td><td>the lineno is matched against it as if it were a one element range
612
+
613
+ </td></tr>
614
+ <tr><td valign="top"><tt>Symbol</tt>:</td><td>the symbol is <tt>sent</tt> to the string; the line is included unless it
615
+ returns false
616
+
617
+ </td></tr>
618
+ <tr><td valign="top"><tt>Proc</tt>:</td><td>the proc is called with the line as an argument; the line is included
619
+ unless it returns false
620
+
621
+ </td></tr>
622
+ </table>
623
+ </li>
624
+ <li><tt>entries</tt>, <tt>files</tt>, <tt>dirs</tt>, <tt>noentries</tt>,
625
+ <tt>nofiles</tt>, <tt>nodirs</tt>
626
+
627
+ <pre>
628
+ rio('adir').files('*.txt')
629
+ rio('adir').nofiles(/^\./)
630
+ </pre>
631
+ <p>
632
+ These methods select which entries will be returned when iterating throug
633
+ directories. Entries are included
634
+ (<tt>entries</tt>,<tt>files</tt>,<tt>dirs</tt>) or
635
+ excluded(<tt>noentries</tt>,<tt>nofiles</tt>,<tt>nodirs</tt>) if they match
636
+ <b>any</b> of the arguments as follows.
637
+ </p>
638
+ <p>
639
+ If the argument is a:
640
+ </p>
641
+ <table>
642
+ <tr><td valign="top"><tt>String</tt>:</td><td>the arg is treated as a glob; the filname is matched against it
643
+
644
+ </td></tr>
645
+ <tr><td valign="top"><tt>RegExp</tt>:</td><td>the filname is matched against it
646
+
647
+ </td></tr>
648
+ <tr><td valign="top"><tt>Symbol</tt>:</td><td>the symbol is <tt>sent</tt> to the entry (a <a href="../Rio.html">Rio</a>);
649
+ the entry is included unless it returns false
650
+
651
+ </td></tr>
652
+ <tr><td valign="top"><tt>Proc</tt>:</td><td>the proc is called with the entry (a <a href="../Rio.html">Rio</a>) as an
653
+ argument; the entry is included unless it returns false
654
+
655
+ </td></tr>
656
+ </table>
657
+ </li>
658
+ <li><tt>records</tt>, <tt>rows</tt>, <tt>norecords</tt>, <tt>norows</tt>
659
+
660
+ <pre>
661
+ rio('afile').bytes(1024).records(0...10)
662
+ </pre>
663
+ <p>
664
+ These select items from an input stream just as <tt>lines</tt>, but without
665
+ specifying lines as the input record type. They can be used to select
666
+ different record types in extension modules. The only such module at this
667
+ writing is the CSV extension. In that case <tt>records</tt> causes each
668
+ line of a CSV file to be parsed into an array while <tt>lines</tt> causes
669
+ each line of the file to be returned normally.
670
+ </p>
671
+ </li>
672
+ </ul>
673
+ <h3><a href="../Rio.html">Rio</a> I/O</h3>
674
+ <p>
675
+ As stated above the the three steps to using a <a
676
+ href="../Rio.html">Rio</a> are:
677
+ </p>
678
+ <ul>
679
+ <li>Creating a <a href="../Rio.html">Rio</a>
680
+
681
+ </li>
682
+ <li>Configuring a <a href="../Rio.html">Rio</a>
683
+
684
+ </li>
685
+ <li>Doing I/O
686
+
687
+ </li>
688
+ </ul>
689
+ <p>
690
+ This section describes that final step.
691
+ </p>
692
+ <p>
693
+ After creating and configuring a <a href="../Rio.html">Rio</a>, the
694
+ file-system has not been accessed, no socket has been opened, not so much
695
+ as a test for a files existance has been done. When an I/O method is called
696
+ on a <a href="../Rio.html">Rio</a>, the sequence of events required to
697
+ complete that operation on the underlying object takes place. <a
698
+ href="../Rio.html">Rio</a> takes care of creating the apropriate object (eg
699
+ IO,Dir), opening the object with the apropriate mode, performing the
700
+ operation, closing the object if required, and returning the results of the
701
+ operation.
702
+ </p>
703
+ <p>
704
+ <a href="../Rio.html">Rio</a>&#8217;s I/O operations can be divide into two
705
+ catagories:
706
+ </p>
707
+ <ul>
708
+ <li>Proxy operations
709
+
710
+ </li>
711
+ <li>Grande operations
712
+
713
+ </li>
714
+ </ul>
715
+ <h4>Proxy operations</h4>
716
+ <p>
717
+ These are calls which are forwarded to the underlying object (eg
718
+ IO,Dir,Net::FTP), after apropriately creating and configuring that object.
719
+ The result produced by the method is returned, and the object is closed.
720
+ </p>
721
+ <p>
722
+ In some cases the result is modified before being returned, as when a <a
723
+ href="../Rio.html">Rio</a> is configured with <tt>chomp</tt>.
724
+ </p>
725
+ <p>
726
+ In all cases, if the result returned by the underlying object, could itself
727
+ be used for further I/O operations it is returned as a <a
728
+ href="../Rio.html">Rio</a>. For example: where File#dirname returns a
729
+ string, <a href="../Rio.html#M000093">Rio#dirname</a> returns a <a
730
+ href="../Rio.html">Rio</a>; where Dir#read returns a string representing a
731
+ directory entry, <a href="../Rio.html#M000039">Rio#read</a> returns a <a
732
+ href="../Rio.html">Rio</a>.
733
+ </p>
734
+ <p>
735
+ With some noteable exceptions, most of the operations available if one were
736
+ using the underlying Ruby I/O class are available to the <a
737
+ href="../Rio.html">Rio</a> and will behave identically.
738
+ </p>
739
+ <p>
740
+ For things that exist on a file system:
741
+ </p>
742
+ <ul>
743
+ <li>All the methods in FileTest are available as <a href="../Rio.html">Rio</a>
744
+ instance methods. For example
745
+
746
+ <pre>
747
+ FileTest.file?('afile')
748
+ </pre>
749
+ <p>
750
+ becomes
751
+ </p>
752
+ <pre>
753
+ rio('afile').file?
754
+ </pre>
755
+ </li>
756
+ <li>All the instance methods of <tt>File</tt> except <tt>path</tt> are
757
+ available to a rio without change
758
+
759
+ </li>
760
+ <li>Most of the class methods of <tt>File</tt> are available.
761
+
762
+ <ul>
763
+ <li>For those that take a filename as their only argument the calls are mapped
764
+ to <a href="../Rio.html">Rio</a> instance methods as described above for
765
+ FileTest.
766
+
767
+ </li>
768
+ <li><tt>dirname</tt>, and <tt>readlink</tt> return Rios instead of strings
769
+
770
+ </li>
771
+ <li><a href="../Rio.html">Rio</a> has its own <a
772
+ href="../Rio.html#M000092">Rio#basename</a>, <a
773
+ href="../Rio.html#M000100">Rio#join</a> and <a
774
+ href="../Rio.html#M000036">Rio#symlink</a>, which provide similar
775
+ functionality.
776
+
777
+ </li>
778
+ <li>The class methods which take multiple filenames
779
+ (<tt>chmod</tt>,<tt>chown</tt>,<tt>lchmod</tt>,<tt>lchown</tt>) are
780
+ available as <a href="../Rio.html">Rio</a> instance methods. For example
781
+
782
+ <pre>
783
+ File.chmod(0666,'afile')
784
+ </pre>
785
+ <p>
786
+ becomes
787
+ </p>
788
+ <pre>
789
+ rio('afile').chmod(06660)
790
+ </pre>
791
+ </li>
792
+ </ul>
793
+ </li>
794
+ </ul>
795
+ <p>
796
+ For I/O Streams
797
+ </p>
798
+ <p>
799
+ Most of the instance methods of IO are available, and most do the same
800
+ thing, with some interface changes. <b>The big exception to this is the
801
+ &#8217;&lt;&lt;&#8217; operator.</b> This is one of <a
802
+ href="../Rio.html">Rio</a>&#8217;s grande operators. While the symantics
803
+ one would use to write to an IO object would actually accomplish the same
804
+ thing with a <a href="../Rio.html">Rio</a>, It is a very different
805
+ operator. Read the section on grande operators. The other differences
806
+ between IO instance methods and the <a href="../Rio.html">Rio</a>
807
+ equivelence can be summarized as follows.
808
+ </p>
809
+ <ul>
810
+ <li>The simple instance methods (eg <tt>fcntl</tt>, <tt>eof?</tt>,
811
+ <tt>tty?</tt> etc.) are forwarded and the result returned as is
812
+
813
+ </li>
814
+ <li>Anywhere IO returns an IO, <a href="../Rio.html">Rio</a> returns a <a
815
+ href="../Rio.html">Rio</a>
816
+
817
+ </li>
818
+ <li><tt>close</tt> and its cousins return the <a href="../Rio.html">Rio</a>.
819
+
820
+ </li>
821
+ <li><tt>each_byte</tt> and <tt>each_line</tt> are forwarded as is.
822
+
823
+ </li>
824
+ <li>All methods which read (read*,get*,each*) will cause the file to closed
825
+ when the end of file is reached. This behavior is configurable, but the
826
+ default is to close on eof
827
+
828
+ </li>
829
+ <li>The methods which write (put*,print*) are forwarded as is; put* and print*
830
+ return the <a href="../Rio.html">Rio</a>; write returns the value returned
831
+ by IO#write; as mentioned above &#8217;&lt;&lt;&#8217; is a grande operator
832
+ in <a href="../Rio.html">Rio</a>.
833
+
834
+ </li>
835
+ </ul>
836
+ <p>
837
+ For directories:
838
+ </p>
839
+ <ul>
840
+ <li>all the instance methods of Dir are available except <tt>each</tt> which is
841
+ a grande method.
842
+
843
+ </li>
844
+ <li>the class methods <tt>mkdir</tt>, <tt>delete</tt>, <tt>rmdir</tt> are
845
+ provided as instance methods.
846
+
847
+ </li>
848
+ <li><tt>chdir</tt> is provided as an instance method. <a
849
+ href="../Rio.html#M000018">Rio#chdir</a> returns a <a
850
+ href="../Rio.html">Rio</a> and passes a <a href="../Rio.html">Rio</a> to a
851
+ block if one is provided.
852
+
853
+ </li>
854
+ <li><tt>glob</tt> is provided as an instance method, but returns an array of
855
+ Rios
856
+
857
+ </li>
858
+ <li><tt>foreach</tt> is not supported
859
+
860
+ </li>
861
+ <li><tt>each</tt> and <tt>[]</tt> have similar functionality provided by <a
862
+ href="../Rio.html">Rio</a>
863
+
864
+ </li>
865
+ </ul>
866
+ <p>
867
+ For other Rios, instance methods are generally forwarded where appropriate.
868
+ For example
869
+ </p>
870
+ <ul>
871
+ <li>Rios that refer to StringIO objects forward &#8216;string&#8217; and
872
+ &#8216;string=&#8217;
873
+
874
+ </li>
875
+ <li>Rios that refer to http URIs support all the Meta methods provided by
876
+ open-uri
877
+
878
+ </li>
879
+ </ul>
880
+ <h4>Grande operators</h4>
881
+ <p>
882
+ The primary grande operator is <a href="../Rio.html#M000046">Rio#each</a>.
883
+ <tt>each</tt> is used to iterate through Rios. When applied to a file it
884
+ iterates through records in the file. When applied to a directory it
885
+ iterates through the entries in the directory. Its behavior is modified by
886
+ configuring the <a href="../Rio.html">Rio</a> prior to calling it using the
887
+ configuration methods discussed above. Since iterating through things is
888
+ ubiquitous in ruby, it is implied by the presence of a block after any of
889
+ the grande configuration methods and many times does not need to be call
890
+ explicitly. For example:
891
+ </p>
892
+ <pre>
893
+ rio('afile.rb').chomp.lines(/^\s*#/) { |line| ... } # iterate through chomped ruby comment lines
894
+ rio('adir').all.files('*.rb') { |f| ... } # iterate through all .rb files in 'adir' and its subdirectories
895
+ </pre>
896
+ <p>
897
+ Because a <a href="../Rio.html">Rio</a> is an Enumerable, it supports
898
+ <tt>to_a</tt>, which is the basis for the grande subscript operator. <a
899
+ href="../Rio.html">Rio</a>#[] with no arguments simply calls to_a. With
900
+ arguments it behaves as if those arguments had been passed to the most
901
+ recently called of the grande selection methods listed above, and then
902
+ calls to_a. For example to get the first ten lines of a file into an array
903
+ with lines chomped
904
+ </p>
905
+ <pre>
906
+ rio('afile').chomp.lines(0...10).to_a
907
+ </pre>
908
+ <p>
909
+ can be written as
910
+ </p>
911
+ <pre>
912
+ rio('afile.gz').chomp.lines[0...10]
913
+ </pre>
914
+ <p>
915
+ or, to create an array of all the .c files in a directory, one could write
916
+ </p>
917
+ <pre>
918
+ rio('adir').files['*.c']
919
+ </pre>
920
+ <p>
921
+ The other grande operators are its copy operators. They are:
922
+ </p>
923
+ <ul>
924
+ <li><tt>&lt;</tt> (copy-from)
925
+
926
+ </li>
927
+ <li><tt>&lt;&lt;</tt> (append-from)
928
+
929
+ </li>
930
+ <li><tt>&gt;</tt> (copy-to)
931
+
932
+ </li>
933
+ <li><tt>&gt;&gt;</tt> (append-to)
934
+
935
+ </li>
936
+ </ul>
937
+ <p>
938
+ The only difference between the &#8216;copy&#8217; and &#8216;append&#8217;
939
+ versions is how they deal with an unopened resource. In the former the open
940
+ it with mode &#8216;w&#8217; and in the latter, mode &#8216;a&#8217;.
941
+ Beyond that, their behavior can be summarized as:
942
+ </p>
943
+ <pre>
944
+ source.each do |entry|
945
+ destination &lt;&lt; entry
946
+ end
947
+ </pre>
948
+ <p>
949
+ Since they are based on the <tt>each</tt> operator, all of the selection
950
+ and configuration options are available. And the right-hand-side argument
951
+ of the operators are not restricted to Rios &#8212; Strings and Arrays are
952
+ also supported.
953
+ </p>
954
+ <p>
955
+ For example:
956
+ </p>
957
+ <pre>
958
+ rio('afile') &gt; astring # copy a file into a string
959
+
960
+ rio('afile').chomp &gt; anarray # copy the chomped lines of afile into an array
961
+
962
+ rio('afile.gz').gzip.lines(0...100) &gt; rio('bfile') # copy 100 lines from a gzipped file into another file
963
+
964
+ rio(?-) &lt; rio('http://rubydoc.org/') # copy a web page to stdout
965
+
966
+ rio('bdir') &lt; rio('adir') # copy an entire directory structure
967
+
968
+ rio('adir').dirs.files('README') &gt; rio('bdir') # same thing, but only README files
969
+
970
+ rio(?-,'ps -a').nolines(0,/ps$/) &gt; anarray # copy the output of th ps command into an array, skippying
971
+ # the header line and the ps command entry
972
+ </pre>
973
+ <h3>Renaming and Moving</h3>
974
+ <p>
975
+ <a href="../Rio.html">Rio</a> provides two methods for directly renaming
976
+ objects on the filesystem: <a href="../Rio.html#M000038">Rio#rename</a> and
977
+ <a href="../Rio.html#M000038">Rio#rename</a>!. Both of these use
978
+ File#rename. The difference between them is the returned <a
979
+ href="../Rio.html">Rio</a>. <a href="../Rio.html#M000038">Rio#rename</a>
980
+ leaves the path of the <a href="../Rio.html">Rio</a> unchanged, while <a
981
+ href="../Rio.html#M000038">Rio#rename</a>! changes the path of the <a
982
+ href="../Rio.html">Rio</a> to refer to the renamed path.
983
+ </p>
984
+ <pre>
985
+ ario = rio('a')
986
+ ario.rename('b') # file 'a' has been renamed to 'b' but 'ario' =&gt; rio('a')
987
+ ario.rename!('b') # file 'a' has been renamed to 'b' and 'ario' =&gt; rio('b')
988
+ </pre>
989
+ <p>
990
+ <a href="../Rio.html">Rio</a> also has a <tt>rename</tt> mode, which causes
991
+ the path manipulation methods <a
992
+ href="../Rio.html#M000093">Rio#dirname</a>=, <a
993
+ href="../Rio.html#M000095">Rio#filename</a>=, <a
994
+ href="../Rio.html#M000092">Rio#basename</a>= and <a
995
+ href="../Rio.html#M000094">Rio#extname</a>= to rename an object on the
996
+ filesystem when they are used to change a <a
997
+ href="../Rio.html">Rio</a>&#8217;s path. A <a href="../Rio.html">Rio</a> is
998
+ put in <tt>rename</tt> mode by calling <a
999
+ href="../Rio.html#M000038">Rio#rename</a> with no arguments.
1000
+ </p>
1001
+ <pre>
1002
+ rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt =&gt; adir/bfile.rb
1003
+ rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt =&gt; adir/bfile.txt
1004
+ rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt =&gt; adir/afile.rb
1005
+ rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt =&gt; b/c/afile.txt
1006
+ </pre>
1007
+ <p>
1008
+ When <tt>rename</tt> mode is set for a directory <a
1009
+ href="../Rio.html">Rio</a>, it is automatically set in the Rios created
1010
+ when iterating through that directory.
1011
+ </p>
1012
+ <pre>
1013
+ rio('adir').rename.files('*.htm') do |frio|
1014
+ frio.extname = '.html' #=&gt; changes the rio and renames the file
1015
+ end
1016
+ </pre>
1017
+ <h3>Deleting</h3>
1018
+ <p>
1019
+ The <a href="../Rio.html">Rio</a> methods for deleting filesystem objects
1020
+ are <a href="../Rio.html#M000034">Rio#rm</a>, <a
1021
+ href="../Rio.html#M000030">Rio#rmdir</a>, <a
1022
+ href="../Rio.html#M000031">Rio#rmtree</a>, <a
1023
+ href="../Rio.html#M000047">Rio#delete</a>, and <a
1024
+ href="../Rio.html#M000047">Rio#delete</a>!. <tt>rm</tt>, <tt>rmdir</tt> and
1025
+ <tt>rmtree</tt> are passed the like named methods in the FileUtils module.
1026
+ <a href="../Rio.html#M000047">Rio#delete</a> calls <tt>rmdir</tt> for
1027
+ directories and <tt>rm</tt> for anything else, while <a
1028
+ href="../Rio.html#M000047">Rio#delete</a>! calls <a
1029
+ href="../Rio.html#M000031">Rio#rmtree</a> for directories.
1030
+ </p>
1031
+ <ul>
1032
+ <li>To delete something only if it is not a directory use <a
1033
+ href="../Rio.html#M000034">Rio#rm</a>
1034
+
1035
+ </li>
1036
+ <li>To delete an empty directory use <a
1037
+ href="../Rio.html#M000030">Rio#rmdir</a>
1038
+
1039
+ </li>
1040
+ <li>To delete an entire directory tree use <a
1041
+ href="../Rio.html#M000031">Rio#rmtree</a>
1042
+
1043
+ </li>
1044
+ <li>To delete anything except a populated directory use <a
1045
+ href="../Rio.html#M000047">Rio#delete</a>
1046
+
1047
+ </li>
1048
+ <li>To delete anything use <a href="../Rio.html#M000047">Rio#delete</a>!
1049
+
1050
+ </li>
1051
+ </ul>
1052
+ <p>
1053
+ It is not an error to call any of the deleting methods on something that
1054
+ does not exist. <a href="../Rio.html">Rio</a> provides Rio#exist? and <a
1055
+ href="../Rio.html#M000036">Rio#symlink</a>? to check if something exists
1056
+ (<tt>exist?</tt> returns false for symlinks to non-existant object even
1057
+ though the symlink itself exists). The deleting methods&#8217; purpose is
1058
+ to make things not exist, so calling one of them on something that already
1059
+ does not exist is considered a success.
1060
+ </p>
1061
+ <p>
1062
+ To create a clean copy of a directory whether or not anything with that
1063
+ name exists you might do this
1064
+ </p>
1065
+ <pre>
1066
+ rio('adir').delete!.mkpath.chdir do
1067
+ # do something in adir
1068
+ end
1069
+ </pre>
1070
+ <p>
1071
+ See also:
1072
+ </p>
1073
+ <ul>
1074
+ <li><a href="SYNOPSIS.html">RIO::Doc::SYNOPSIS</a>
1075
+
1076
+ </li>
1077
+ <li><a href="HOWTO.html">RIO::Doc::HOWTO</a>
1078
+
1079
+ </li>
1080
+ <li><a href="../Rio.html">RIO::Rio</a>
1081
+
1082
+ </li>
1083
+ </ul>
1084
+
1085
+ </div>
1086
+
1087
+
1088
+ </div>
1089
+
1090
+
1091
+ </div>
1092
+
1093
+
1094
+ <!-- if includes -->
1095
+
1096
+ <div id="section">
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+ <!-- if method_list -->
1106
+
1107
+
1108
+ </div>
1109
+
1110
+
1111
+ <div id="validator-badges">
1112
+ <p><small>Copyright &copy; 2005 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
1113
+ </div>
1114
+
1115
+ </body>
1116
+ </html>