rio 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,413 @@
1
+ #--
2
+ # ===============================================================================
3
+ # Copyright (c) 2005, Christopher Kleckner
4
+ # All rights reserved
5
+ #
6
+ # This file is part of the Rio library for ruby.
7
+ #
8
+ # Rio is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # Rio is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with Rio; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ # ===============================================================================
22
+ #++
23
+ #
24
+ # To create the documentation for Rio run the command
25
+ # rake rdoc
26
+ # from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
27
+ #
28
+ # Suggested Reading
29
+ # * RIO::Doc::SYNOPSIS
30
+ # * RIO::Doc::INTRO
31
+ # * RIO::Doc::HOWTO
32
+ # * RIO::Rio
33
+ #
34
+ # <b>Rio is pre-alpha software.
35
+ # The documented interface and behavior is subject to change without notice.</b>
36
+
37
+
38
+ module RIO
39
+ class Rio
40
+
41
+ # Returns the path for the Rio, which is defined differently for different types of Rios.
42
+ #
43
+ # For Rios representing paths on the underlying file system this proxies URI::FILE#path or URI::Generic#path
44
+ # depending on whether the Rio is absolute or not. Note that this is *not* the same as Rio#fspath, but rather
45
+ # a URL path as defined in RFC 1738.
46
+ #
47
+ # For HTTP Rios this proxies this proxies URI::HTTP#path
48
+ #
49
+ # For special Rios such as stdin: and stderr: this returns the special symbol used to create the Rio
50
+ #
51
+ # Specifically:
52
+ # '-' => stdio:
53
+ # '=' => stderr:
54
+ # '?' => tempfile:
55
+ # '$' => stringio:
56
+ # '_' => sysio:
57
+ #
58
+ # This list of possible paths may not be comprehensive as new types of Rios are added, however,
59
+ # A Rio should always return a path when the underlying object has a concept of a path and something
60
+ # else that is reasonable for Rios that have no such concept
61
+ #
62
+ def path(*args) target.path(*args) end
63
+
64
+ def to_url() target.to_url end
65
+ def to_uri() target.to_uri end
66
+
67
+ # Returns the path for the Rio on the underlying file system
68
+ # Returns nil if the Rio is not on the filesystem (i.e. stdin: or http: Rios)
69
+ def fspath(*args) target.fspath(*args) end
70
+
71
+ # Proxy for File#expand_path
72
+ #
73
+ # Converts a pathname to an absolute pathname.
74
+ # Relative paths are referenced from the current working directory of the process
75
+ # unless dir_string is given, in which case it will be used as the starting point.
76
+ # The given pathname may start with a ``~��, which expands to the process owner�s
77
+ # home directory (the environment variable HOME must be set correctly).
78
+ # ``~user�� expands to the named user�s home directory.
79
+ #
80
+ # Returns a Rio representing the returned path
81
+ #
82
+ #
83
+ def expand_path(*args) target.expand_path(*args) end
84
+
85
+
86
+ # Returns a new rio with a path equal to the absolute path of this rio
87
+ #
88
+ # rio('/tmp').chdir
89
+ # rio('afile').abs # => rio('/tmp/afile')
90
+ def abs(*args) target.abs(*args) end
91
+
92
+
93
+ # Returns a new rio with a path equal to the relative path from _other_
94
+ # rio('/tmp/afile').rel('/tmp') #=> rio('afile')
95
+ # rio('zippy/afile').rel('zippy') #=> rio('afile')
96
+ #
97
+ def rel(other) target.rel(other) end
98
+
99
+
100
+ # Sets the string that the Rio considers an extension. The value will be used by
101
+ # subsequent calls to Rio#basename. If called with no arguments resets its value
102
+ # to the value returned by File#extname. Returns the Rio
103
+ # ario = rio('afile.txt')
104
+ # ario.ext('.txt').basename #=> rio('afile')
105
+ # ario.ext('.zip').basename #=> rio('afile.txt')
106
+ # ario.ext.basename #=> rio('afile')
107
+ # ario.ext('').basename #=> rio('afile.txt')
108
+ # See also Rio#ext,Rio#ext?,Rio#filename,
109
+ #
110
+ def ext(arg=nil) target.ext(arg); self end
111
+
112
+
113
+ # Identical to Rio#ext('')
114
+ # See Rio#ext
115
+ # ario.basename #=> rio('afile')
116
+ # ario.noext.basename #=> rio('afile.txt')
117
+ #
118
+ def noext() target.noext(); self end
119
+
120
+
121
+ # Returns the value of the Rio's 'ext' variable
122
+ # This defaults to the value returned by Rio#extname and may be set by either calling Rio#ext
123
+ # or by passing an argument Rio#basename
124
+ # See also Rio#basename, Rio#ext, Rio#extname, Rio#noext
125
+ #
126
+ # ario = rio('afile.txt')
127
+ # ario.ext? #=> '.txt'
128
+ # ario.ext('.txt').basename #=> rio('afile')
129
+ # ario.ext? #=> '.txt'
130
+ # ario.ext('.zip').basename #=> rio('afile.txt')
131
+ # ario.ext? #=> '.zip'
132
+ # ario.basename('.tar') #=> rio('afile.txt')
133
+ # ario.ext? #=> '.tar'
134
+ # ario.ext.basename #=> rio('afile')
135
+ # ario.ext? #=> '.txt'
136
+ # ario.noext.basename #=> rio('afile.txt')
137
+ # ario.ext? #=> ''
138
+ #
139
+ def ext?() target.ext?() end
140
+
141
+
142
+ # Similar to File#basename
143
+ #
144
+ # Returns a Rio whose path is that returned by File#basename when passed the path
145
+ # of a rio and the value returned by File#extname. This differs from the behaviour
146
+ # of File#basename.
147
+ # File.basename('afile.txt') #=> 'afile.txt'
148
+ # File.basename('afile.txt',File.extname('afile.txt')) #=> 'afile'
149
+ # rio('afile.txt').basename #=> rio('afile')
150
+ # rio('afile.txt').basename('.txt') #=> same thing
151
+ # rio('afile.txt').ext('.txt').basename #=> same thing
152
+ # See also Rio#ext,Rio#ext?,Rio#filename,
153
+ def basename(*args) target.basename(*args) end
154
+
155
+
156
+ # Calls File#dirname
157
+ #
158
+ # Returns a new Rio referencing the directory portion of a Rio.
159
+ # rio('/tmp/zippy.txt').dirname #=> rio('/tmp')
160
+ #
161
+ def dirname(*args) target.dirname(*args) end
162
+
163
+
164
+ # Calls File#extname
165
+ #
166
+ # Returns a String containing the path's extension
167
+ # rio('/tmp/zippy.txt').extname #=> rio('.txt')
168
+ #
169
+ def extname(*args) target.extname(*args) end
170
+
171
+
172
+ # Returns a new Rio with all path information stripped away. This is similar to
173
+ # Rio#basename, except that it always includes an extension if one exists
174
+ #
175
+ # rio('apath/afile.txt').filename #=> rio('afile.txt')
176
+ #
177
+ def filename() target.filename() end
178
+
179
+
180
+ # Replace the part of the path returned by Rio#extname. If in +rename+
181
+ # mode, also renames the referenced filesystem object.
182
+ #
183
+ # Returns the extension
184
+ #
185
+ # ario = rio('dirA/dirB/afile.rb')
186
+ # ario.extname = '.txt' # rio('dirC/bfile.txt')
187
+ #
188
+ # rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
189
+ #
190
+ # See Rio#extname, Rio#rename
191
+ #
192
+ def extname=(arg) target.extname = arg end
193
+
194
+
195
+ # Replace the part of the path returned by Rio#basename. If in +rename+
196
+ # mode, also renames the referenced filesystem object.
197
+ #
198
+ # Returns the new value of +basename+
199
+ #
200
+ # ario = rio('dirA/dirB/afile.rb')
201
+ # ario.dirname = 'dirC' # rio('dirC/afile.rb')
202
+ # ario.basename = 'bfile' # rio('dirC/bfile.rb')
203
+ # ario.extname = '.txt' # rio('dirC/bfile.txt')
204
+ # ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
205
+ #
206
+ # rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
207
+ # rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
208
+ # rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
209
+ # rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
210
+ #
211
+ # See Rio#basename, Rio#rename
212
+ #
213
+ def basename=(arg) target.basename = arg end
214
+
215
+
216
+ # Replace the part of the path returned by Rio#dirname. If in +rename+
217
+ # mode, also renames the referenced filesystem object.
218
+ #
219
+ # Returns the new value of +dirname+
220
+ #
221
+ # ario = rio('dirA/dirB/afile.rb')
222
+ # ario.dirname = 'dirC' # rio('dirC/afile.rb')
223
+ # ario.basename = 'bfile' # rio('dirC/bfile.rb')
224
+ # ario.extname = '.txt' # rio('dirC/bfile.txt')
225
+ # ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
226
+ #
227
+ # rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
228
+ # rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
229
+ # rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
230
+ # rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
231
+ #
232
+ # See Rio#dirname, Rio#rename
233
+ #
234
+ def dirname=(arg) target.dirname = arg end
235
+
236
+
237
+
238
+ # Replace the part of the path returned by Rio#filename. If in +rename+
239
+ # mode, also renames the referenced filesystem object.
240
+ #
241
+ # Returns the new value of +filename+
242
+ #
243
+ # ario = rio('dirA/dirB/afile.rb')
244
+ # ario.dirname = 'dirC' # rio('dirC/afile.rb')
245
+ # ario.basename = 'bfile' # rio('dirC/bfile.rb')
246
+ # ario.extname = '.txt' # rio('dirC/bfile.txt')
247
+ # ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
248
+ #
249
+ # rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt => adir/bfile.rb
250
+ # rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
251
+ # rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
252
+ # rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => b/c/afile.txt
253
+ #
254
+ # See Rio#filename, Rio#rename
255
+ #
256
+ def filename=(arg) target.filename = arg end
257
+
258
+
259
+ # Creates new Rio by adding args as additional directory components like File#join.
260
+ #
261
+ # ario = rio('adir')
262
+ # brio = rio('b')
263
+ # crio = ario.join(brio) #=> rio('adir/b')
264
+ #
265
+ # ario = rio('adir')
266
+ # ario.join('b','c','d') #=> rio('ario/b/c/d')
267
+ #
268
+ # See also Rio#/
269
+ def join(*args) target.join(*args) end
270
+
271
+
272
+ # Creates an array of Rios, one for each path element.
273
+ # (Note that this behavior differs from File#split.)
274
+ #
275
+ # rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
276
+ #
277
+ # The array returned is extended with a +to_rio+ method,
278
+ # which will put the parts back together again.
279
+ #
280
+ # ary = rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
281
+ # ary.to_rio #=> rio('a/b/c')
282
+ #
283
+ # ary = rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
284
+ # ary[1] = rio('d')
285
+ # ary.to_rio #=> rio('a/d/c')
286
+ #
287
+ # See also Rio#join, Rio#/
288
+ def split() target.split() end
289
+
290
+
291
+ # Subdirectory operator.
292
+ #
293
+ # Effectively the same as Rio#join(arg)
294
+ #
295
+ # a = rio('a')
296
+ # b = rio('b')
297
+ # c = a/b #=> rio('a/b')
298
+ #
299
+ # ario = rio('adir')
300
+ # ario/'afile.rb' #=> rio('ario/afile.rb')
301
+ # ario/'b'/'c'/'d' #=> rio('ario/b/c/d')
302
+ #
303
+ # ario = rio('adir')
304
+ # ario /= 'afile.rb' #=> rio('ario/afile.rb')
305
+ #
306
+ def /(arg) target / arg end
307
+
308
+
309
+ # Create a Rio referencing Rio#to_s + arg.to_s
310
+ #
311
+ def +(arg) target + arg end
312
+
313
+ # Create a new Rio referencing the result of applying String#sub to the value returned by
314
+ # Rio#to_s
315
+ def sub(re,string) target.sub(re,string) end
316
+
317
+ # Create a new Rio referencing the result of applying String#gsub to the value returned by
318
+ # Rio#to_s
319
+ def gsub(re,string) target.gsub(re,string) end
320
+
321
+
322
+ # Rio#catpath!
323
+ #
324
+ #
325
+ #def catpath!(*args) target.catpath!(*args); self end
326
+
327
+
328
+ # Rio#catpath
329
+ #
330
+ #
331
+ #def catpath(*args) target.catpath(*args) end
332
+
333
+
334
+ # Changes a Rio inplace by adding args as additional directory components like Rio#join,
335
+ #
336
+ def join!(*args) target.join!(*args); self end
337
+
338
+ # Rio#rootpath
339
+ #
340
+ #
341
+ def rootpath(*args) target.rootpath(*args) end
342
+
343
+
344
+ # Rio#root
345
+ #
346
+ #
347
+ ##def root(*args,&block) target.root(*args,&block) end
348
+
349
+
350
+ # Rio#cwd
351
+ #
352
+ #
353
+ ##def cwd(*args,&block) target.cwd(*args,&block) end
354
+
355
+
356
+ # Rio#getwd
357
+ #
358
+ #
359
+ ##def getwd(*args,&block) target.getwd(*args,&block) end
360
+
361
+
362
+ # Rio#base
363
+ #
364
+ #
365
+ def base() target.base() end
366
+
367
+
368
+ # Returns the scheme for Rio's URI like URI#scheme where the Rio is represented
369
+ # by a standard URI. For Rios that are not represented by standard URIs one of
370
+ # Rio's non-standard schemes's is returned.
371
+ #
372
+ # rio('http://ruby-doc.org/') #=> 'http'
373
+ #
374
+ def scheme(*args) target.scheme(*args) end
375
+
376
+ # Proxy for URI#host
377
+ #
378
+ # rio('http://ruby-doc.org/') #=> 'ruby-doc'
379
+ #
380
+ def host(*args) target.host(*args) end
381
+
382
+ # Proxy for URI#opaque
383
+ #
384
+ def opaque(*args) target.opaque(*args) end
385
+
386
+
387
+
388
+ # Proxy for URI#merge
389
+ #
390
+ # Merges to Rios. URI#merge does not document exactly what merging to URIs means. This appears to
391
+ # join the the paths with like <tt>other + path</tt>. See URI#merge for less information.
392
+ #
393
+ #
394
+ def merge(other) target.merge(other) end
395
+
396
+
397
+ # Proxy for URI#route_from
398
+ #
399
+ # Returns a new rio representing the path to this Rio from the perspective of _other_.
400
+ # URI#route_from requires that absolute URIs be used. Rio#route_from does not.
401
+ #
402
+ def route_from(other) target.route_from(other) end
403
+
404
+ # Proxy for URI#route_to
405
+ #
406
+ # Returns a new rio representing the path to _other_ from the perspective of this Rio.
407
+ # URI#route_to requires that absolute URIs be used. Rio#route_to does not.
408
+ #
409
+ def route_to(other) target.route_to(other) end
410
+
411
+
412
+ end
413
+ end
@@ -0,0 +1,599 @@
1
+ #--
2
+ # ===============================================================================
3
+ # Copyright (c) 2005, Christopher Kleckner
4
+ # All rights reserved
5
+ #
6
+ # This file is part of the Rio library for ruby.
7
+ #
8
+ # Rio is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # Rio is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with Rio; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ # ===============================================================================
22
+ #++
23
+ #
24
+ # To create the documentation for Rio run the command
25
+ # rake rdoc
26
+ # from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
27
+ #
28
+ # Suggested Reading
29
+ # * RIO::Doc::SYNOPSIS
30
+ # * RIO::Doc::INTRO
31
+ # * RIO::Doc::HOWTO
32
+ # * RIO::Rio
33
+ #
34
+ # <b>Rio is pre-alpha software.
35
+ # The documented interface and behavior is subject to change without notice.</b>
36
+
37
+
38
+ module RIO
39
+ class Rio
40
+ # Calls IO#gets
41
+ #
42
+ # Reads the next line from the Rio; lines are separated by sep_string.
43
+ # A separator of nil reads the entire contents, and a zero-length separator reads
44
+ # the input a paragraph at a time (two successive newlines in the input separate paragraphs).
45
+ #
46
+ # Returns nil if called at end of file.
47
+ #
48
+ # astring = rio('afile.txt').gets # read the first line of afile.txt into astring
49
+ #
50
+ def gets(sep_string=$/) target.gets(sep_string) end
51
+
52
+ # Slurps the contents of the rio into a string. See also Rio#contents
53
+ #
54
+ # astring = rio('afile.txt').slurp # slurp the entire contents of afile.txt into astring
55
+ #
56
+ # Alpha Note: Considering removing Rio#contents and Rio#slurp in favor of +to_string+. Is
57
+ # this the Ruby way? Is it too confusing with a +to_s+ and +to_str+ already? Is it a good idea?
58
+ def slurp() target.slurp() end
59
+
60
+ # Returns the contents of the rio as a string. See also Rio#slurp
61
+ #
62
+ # astring = rio('afile.txt').contents # copies the entire contents of afile.txt into astring
63
+ #
64
+ # Alpha Note: Considering removing Rio#contents and Rio#slurp in favor of +to_string+. Is
65
+ # this the Ruby way? Is it too confusing with a +to_s+ and +to_str+ already? Is it a good idea?
66
+ def contents() target.contents() end
67
+
68
+
69
+
70
+ # Rio#each_record
71
+ #
72
+ #
73
+ #def each_record(&block) target.each_record(&block); self end
74
+
75
+
76
+ # Rio#each_row
77
+ #
78
+ #
79
+ #def each_row(&block) target.each_row(&block); self end
80
+
81
+
82
+ # Calls IO#lineno
83
+ #
84
+ # Returns the current line number of a Rio.
85
+ #
86
+ # The Rio will be opened for reading if not already.
87
+ # lineno counts the number of times gets is called, rather than the number of newlines encountered --
88
+ # so lineno will only be accurate if the file is read exclusively with line-oriented methods
89
+ # (Rio#readline, Rio#each_line, Rio#gets etc.)
90
+ #
91
+ # See also the $. variable and Rio#recno
92
+ # f = rio("testfile")
93
+ # f.lineno #=> 0
94
+ # f.gets #=> "This is line one\n"
95
+ # f.lineno #=> 1
96
+ # f.gets #=> "This is line two\n"
97
+ # f.lineno #=> 2
98
+ def lineno() target.lineno() end
99
+
100
+ # Calls IO#lineno=
101
+ # ario.lineno = integer => integer
102
+ # Manually sets the current line number to the given value. +$.+ is
103
+ # updated only on the next read.
104
+ #
105
+ # f = rio("testfile")
106
+ # f.gets #=> "This is line one\n"
107
+ # $. #=> 1
108
+ # f.lineno = 1000
109
+ # f.lineno #=> 1000
110
+ # $. # lineno of last read #=> 1
111
+ # f.gets #=> "This is line two\n"
112
+ # $. # lineno of last read #=> 1001
113
+ #
114
+ #
115
+ def lineno=(integer) target.lineno = integer end
116
+
117
+ # Returns the current record number of a Rio. The +recno+ is the index
118
+ # used by the grande selection methods. It represents the zero-based index of the
119
+ # last record read. Returns nil until a record has been read.
120
+ #
121
+ # see Rio#lines Rio#bytes and Rio#records
122
+ #
123
+ # To illustrate: Given a file containing three lines "L0\n","L1\n","L2\n"
124
+ # and a Range (0..1)
125
+ # Each of the following would fill ay with ["L0\n", "L1\n"]
126
+ #
127
+ # ay = []
128
+ # range = (0..1)
129
+ # ain = rio('afile').readlines
130
+ # ain.each_with_index do |line,i|
131
+ # ay << line if range === i
132
+ # end
133
+ #
134
+ # ay = rio('afile').lines[0..1]
135
+ #
136
+ # +recno+ counts the number of times Rio#getrec or Rio#each is used to get a record.
137
+ # so +recno+ will only concern parts of the file read with grande methods
138
+ # Rio#each, Rio#[], Rio#getrec
139
+ #
140
+ # See also Rio#lineno
141
+ # f = rio("afile")
142
+ # r1 = (0..1)
143
+ # r2 = (100..101)
144
+ #
145
+ # aout1 = []
146
+ # f.each { |rec|
147
+ # aout << rec if r1 === f.recno or r2 === f.recno
148
+ # }
149
+ #
150
+ # aout2 = f[r1,r2]
151
+ #
152
+ # aout1 == aout2 # true
153
+ #
154
+ def recno() target.recno() end
155
+
156
+
157
+ # Calls IO#binmode
158
+ #
159
+ # Puts rio into binary mode. This is useful only in MS-DOS/Windows environments.
160
+ # Once a stream is in binary mode, it cannot be reset to nonbinary mode.
161
+ #
162
+ # Returns the Rio.
163
+ #
164
+ # rio('afile.exe').binmode.bytes(512).to_a # read a file in 512 byte blocks
165
+ #
166
+ def binmode() target.binmode(); self end
167
+
168
+
169
+ # Calls IO#flush
170
+ # ario.flush => ario
171
+ # Flushes any buffered data within _ario_ to the underlying operating
172
+ # system (note that this is Ruby internal buffering only; the OS may
173
+ # buffer the data as well).
174
+ #
175
+ def flush() target.flush(); self end
176
+
177
+
178
+ # Calls IO#each_byte
179
+ # ario.each_byte {|byte| block } => ario
180
+ # Calls the given block once for each byte (0..255) in _ario_, passing
181
+ # the byte as an argument.
182
+ #
183
+ def each_byte(*args,&block) target.each_byte(*args,&block); self end
184
+
185
+
186
+ # Rio#each_bytes
187
+ #
188
+ #
189
+ #def each_bytes(nb,*args,&block) target.each_bytes(nb,*args,&block); self end
190
+
191
+
192
+ # Calls IO#each_line
193
+ # ario.each_line(sep_string=$/) {|line| block } => ario
194
+ # Executes the block for every line in _ario_, where lines are
195
+ # separated by _sep_string_.
196
+ #
197
+ def each_line(*args,&block) target.each_line(*args,&block); self end
198
+
199
+
200
+ # Calls IO#readlines
201
+ #
202
+ # Reads all of the lines in a Rio, and returns them in anArray.
203
+ # Lines are separated by the optional aSepString.
204
+ # The stream must be opened for reading or an IOerror will be raised.
205
+ #
206
+ # an_array = rio('afile.txt').readlines # read afile.txt into an array
207
+ # an_array = rio('afile.txt').chomp.readlines # read afile.txt into an array with each line chomped
208
+ #
209
+ def readlines(*args,&block) target.readlines(*args,&block) end
210
+
211
+ # Calls IO#readline
212
+ # ario.readline(sep_string=$/) => string
213
+ # Reads a line as with +IO#gets+, but raises an +EOFError+ on end of
214
+ # file.
215
+ #
216
+ def readline(*args) target.readline(*args) end
217
+
218
+
219
+ # Calls IO::print
220
+ #
221
+ # Writes the given object(s) to the Rio. If the output record separator ($\) is not nil,
222
+ # it will be appended to the output. If no arguments are given, prints $_.
223
+ # Objects that aren't strings will be converted by calling their to_s method.
224
+ # Returns the Rio.
225
+ #
226
+ # rio('f.txt').print("Hello Rio\n") # print the string to f.txt
227
+ # rio(?-).print("Hello Rio\n") # print the string to stdout
228
+ #
229
+ def print(*args,&block) target.print(*args,&block); self end
230
+
231
+ # Writes the given objects to the rio as with Rio#print and then closes the Rio.
232
+ # Returns the Rio.
233
+ #
234
+ # Equivalent to rio.print(*args).close
235
+ #
236
+ # rio('f.txt').print!("Hello Rio\n") # print the string to f.txt then close it
237
+ #
238
+ def print!(*args,&block) target.print!(*args,&block); self end
239
+
240
+
241
+ # Writes the given objects to the rio as with Rio#printf and then closes the rio.
242
+ # Returns the rio.
243
+ #
244
+ # Equivalent to rio.printf(*args).close
245
+ #
246
+ def printf!(*argv) target.printf!(*argv); self end
247
+
248
+
249
+ # Calls IO#printf
250
+ # ario.printf(format_string [, obj, ...] ) => ario
251
+ # Formats and writes to _ario_, converting parameters under control of
252
+ # the format string. See +Kernel#sprintf+ for details.
253
+ #
254
+ def printf(*argv) target.printf(*argv); self end
255
+
256
+
257
+ # Writes the given objects to the rio as with Rio#putc and then closes the rio.
258
+ # Returns the rio.
259
+ #
260
+ # Equivalent to rio.putc(*args).close
261
+ #
262
+ def putc!(*argv) target.putc!(*argv); self end
263
+
264
+
265
+ # Calls IO#putc
266
+ # ario.putc(obj) => ario
267
+ # If _obj_ is +Numeric+, write the character whose code is _obj_,
268
+ # otherwise write the first character of the string representation of
269
+ # _obj_ to _ario_.
270
+ #
271
+ # stdout = rio(?-)
272
+ # stdout.putc "A"
273
+ # stdout.putc 65
274
+ #
275
+ # _produces:_
276
+ #
277
+ # AA
278
+ #
279
+ def putc(*argv) target.putc(*argv); self end
280
+
281
+
282
+ # Calls IO#puts
283
+ #
284
+ # Writes the given objects to the rio as with Rio#print .
285
+ # Writes a record separator (typically a newline) after any that do not already end with a newline sequence.
286
+ # If called with an array argument, writes each element on a new line.
287
+ # If called without arguments, outputs a single record separator.
288
+ # Returns the rio.
289
+ def puts(*args) target.puts(*args); self end
290
+
291
+ # Writes the given objects to the rio as with Rio#puts and then closes the rio.
292
+ # Returns the rio.
293
+ #
294
+ # Equivalent to rio.puts(*args).close
295
+ #
296
+ # rio('f.txt').puts!('Hello Rio') # print the string to f.txt then close it
297
+ #
298
+ def puts!(*args) target.puts!(*args); self end
299
+
300
+
301
+ # Writes the given objects to the rio as with Rio#write and then closes the rio.
302
+ #
303
+ # Equivalent to
304
+ # ario.write(*args)
305
+ # ario.close
306
+ #
307
+ def write!(*argv) target.write!(*argv); self end
308
+
309
+
310
+ # Calls IO#write
311
+ # ario.write(string) => integer
312
+ # Writes the given string to _ario_. If the argument is not a string,
313
+ # it will be converted to a
314
+ # string using +to_s+. Returns the number of bytes written.
315
+ #
316
+ def write(*argv) target.write(*argv); self end
317
+
318
+
319
+ # Calls IO#eof?
320
+ # ario.eof => true or false
321
+ # Returns true if _ario_ is at end of file. The stream must be opened
322
+ # for reading or an +IOError+ will be raised.
323
+ #
324
+ def eof?() target.eof? end
325
+
326
+ # Provides direct access to the IO handle (as would be returned by ::IO#new) *with* filtering.
327
+ # Reading from and writing to this handle will be affected
328
+ # by such things as Rio#gzip and Rio#chomp if they were specified for the Rio.
329
+ #
330
+ # Compare this with Rio#ios
331
+ #
332
+ def ioh(*args) target.ioh() end
333
+
334
+ # Provides direct access to the IO handle (as would be returned by ::IO#new)
335
+ # Reading from and writing to this handle
336
+ # is *not* affected by such things as Rio#gzip and Rio#chomp.
337
+ #
338
+ # Compare this with Rio#ioh
339
+ #
340
+ def ios(*args) target.ios() end
341
+
342
+ #def open(m,*args) target.open(m,*args); self end
343
+
344
+ # Explicitly set the mode with which a Rio will be opened.
345
+ # ario.mode('r+') => ario
346
+ # Normally one needs never open a Rio or specify its mode -- the mode is determined by the
347
+ # operation the Rio is asked to perform. (i.e. Rio#print requires write access, Rio#readlines requires
348
+ # read access). However there are times when one wishes to be specific about the mode with which a Rio
349
+ # will be opened. Note that explicitly setting the mode overrides all of Rio's internal mode
350
+ # logic. If a mode is specified via Rio#mode or Rio#open that mode will be used. Period.
351
+ #
352
+ # Returns the Rio.
353
+ #
354
+ # See also Rio#mode?
355
+ #
356
+ # If the mode is given as a String, it must be one of the values listed in the following table.
357
+ #
358
+ # Mode | Meaning
359
+ # -----+--------------------------------------------------------
360
+ # "r" | Read-only, starts at beginning of file (default mode).
361
+ # -----+--------------------------------------------------------
362
+ # "r+" | Read-write, starts at beginning of file.
363
+ # -----+--------------------------------------------------------
364
+ # "w" | Write-only, truncates existing file
365
+ # | to zero length or creates a new file for writing.
366
+ # -----+--------------------------------------------------------
367
+ # "w+" | Read-write, truncates existing file to zero length
368
+ # | or creates a new file for reading and writing.
369
+ # -----+--------------------------------------------------------
370
+ # "a" | Write-only, starts at end of file if file exists,
371
+ # | otherwise creates a new file for writing.
372
+ # -----+--------------------------------------------------------
373
+ # "a+" | Read-write, starts at end of file if file exists,
374
+ # | otherwise creates a new file for reading and
375
+ # | writing.
376
+ # -----+--------------------------------------------------------
377
+ # "b" | (DOS/Windows only) Binary file mode (may appear with
378
+ # | any of the key letters listed above).
379
+ #
380
+ # ario = rio('afile').mode('r+').nocloseoneof # file will be opened in r+ mode
381
+ # # don't want the file closed at eof
382
+ # ario.seek(apos).gets # read the string at apos in afile
383
+ # ario.rewind.gets # read the string at the beginning of the file
384
+ # ario.close
385
+ #
386
+ # TODO:
387
+ # * Add support for integer modes
388
+ #
389
+ def mode(m,*args) target.mode(m,*args); self end
390
+
391
+ # Query a Rio's mode
392
+ # ario.mode? #=> a mode string
393
+ #
394
+ # See Rio#mode
395
+ #
396
+ # ario = rio('afile')
397
+ # ario.puts("Hello World")
398
+ # ario.mode? #=> 'w' Rio#puts requires write access
399
+ #
400
+ # ario = rio('afile')
401
+ # ario.gets
402
+ # ario.mode? #=> 'r' Rio#gets requires read access
403
+ #
404
+ # ario = rio('afile').mode('w+').nocloseoneof
405
+ # ario.gets
406
+ # ario.mode? #=> 'w+' Set explictly
407
+ #
408
+ def mode?() target.mode?() end
409
+
410
+
411
+
412
+ # Calls IO#close
413
+ # ario.close => nil
414
+ # Closes _ario_ and flushes any pending writes to the operating
415
+ # system. The stream is unavailable for any further data operations;
416
+ # an +IOError+ is raised if such an attempt is made. I/O streams are
417
+ # automatically closed when they are claimed by the garbage
418
+ # collector.
419
+ #
420
+ def close() target.close(); self end
421
+
422
+ # Calls IO#fcntl
423
+ # ario.fcntl(integer_cmd, arg) => integer
424
+ # Provides a mechanism for issuing low-level commands to control or
425
+ # query file-oriented I/O streams. Arguments and results are platform
426
+ # dependent. If _arg_ is a number, its value is passed directly. If
427
+ # it is a string, it is interpreted as a binary sequence of bytes
428
+ # (+Array#pack+ might be a useful way to build this string). On Unix
429
+ # platforms, see +fcntl(2)+ for details. Not implemented on all
430
+ # platforms.
431
+ #
432
+ #
433
+ def fcntl(integer_cmd,arg) target.fcntl(integer_cmd,arg) end
434
+
435
+ # Calls IO#ioctl
436
+ # ario.ioctl(integer_cmd, arg) => integer
437
+ # Provides a mechanism for issuing low-level commands to control or
438
+ # query I/O devices. Arguments and results are platform dependent. If
439
+ # _arg_ is a number, its value is passed directly. If it is a string,
440
+ # it is interpreted as a binary sequence of bytes. On Unix platforms,
441
+ # see +ioctl(2)+ for details. Not implemented on all platforms.
442
+ #
443
+ #
444
+ def ioctl(integer_cmd,arg) target.ioctl(integer_cmd,arg) end
445
+
446
+ # Calls IO#fileno
447
+ # ario.fileno => fixnum
448
+ # ario.to_i => fixnum
449
+ # Returns an integer representing the numeric file descriptor for
450
+ # _ario_.
451
+ #
452
+ def fileno() target.fileno() end
453
+
454
+
455
+ # Calls IO#fsync
456
+ # ario.fsync => ario
457
+ # Immediately writes all buffered data in _ario_ to disk and
458
+ # return _ario_.
459
+ # Does nothing if the underlying operating system does not support
460
+ # _fsync(2)_. Note that +fsync+ differs from using Rio#sync. The
461
+ # latter ensures that data is flushed from Ruby's buffers, but
462
+ # doesn't not guarantee that the underlying operating system actually
463
+ # writes it to disk.
464
+ #
465
+ def fsync() target.fsync end
466
+
467
+ # Calls IO#pid
468
+ # ario.pid => fixnum
469
+ # Returns the process ID of a child process associated with _ario_.
470
+ # This will be set by +IO::popen+.
471
+ #
472
+ # pipe = IO.popen("-")
473
+ # if pipe
474
+ # $stderr.puts "In parent, child pid is #{pipe.pid}"
475
+ # else
476
+ # $stderr.puts "In child, pid is #{$$}"
477
+ # end
478
+ #
479
+ # _produces:_
480
+ #
481
+ # In child, pid is 26209
482
+ # In parent, child pid is 26209
483
+ #
484
+ #
485
+
486
+
487
+ # Calls IO#putc
488
+ # ario.putc(obj) => obj
489
+ # If _obj_ is +Numeric+, write the character whose code is _obj_,
490
+ # otherwise write the first character of the string representation of
491
+ # _obj_ to _ario_.
492
+ #
493
+ # $stdout.putc "A"
494
+ # $stdout.putc 65
495
+ #
496
+ # _produces:_
497
+ #
498
+ # AA
499
+ #
500
+ #
501
+
502
+
503
+ # Calls IO#getc
504
+ # ario.getc => fixnum or nil
505
+ # Gets the next 8-bit byte (0..255) from _ario_. Returns +nil+ if
506
+ # called at end of file.
507
+ #
508
+ # f = File.new("testfile")
509
+ # f.getc #=> 84
510
+ # f.getc #=> 104
511
+ #
512
+ #
513
+
514
+ # Calls IO#readchar
515
+ # ario.readchar => fixnum
516
+ # Reads a character as with +IO#getc+, but raises an +EOFError+ on
517
+ # end of file.
518
+ #
519
+ #
520
+
521
+ # Calls IO#reopen
522
+ # ario.reopen(other_IO) => ios
523
+ # ario.reopen(path, mode_str) => ios
524
+ # Reassociates _ario_ with the I/O stream given in _other_IO_ or to a
525
+ # new stream opened on _path_. This may dynamically change the actual
526
+ # class of this stream.
527
+ #
528
+ # f1 = File.new("testfile")
529
+ # f2 = File.new("testfile")
530
+ # f2.readlines[0] #=> "This is line one\n"
531
+ # f2.reopen(f1) #=> #<File:testfile>
532
+ # f2.readlines[0] #=> "This is line one\n"
533
+ #
534
+ #
535
+
536
+ # Calls IO#stat
537
+ # ario.stat => stat
538
+ # Returns status information for _ario_ as an object of type
539
+ # +File::Stat+.
540
+ #
541
+ # f = File.new("testfile")
542
+ # s = f.stat
543
+ # "%o" % s.mode #=> "100644"
544
+ # s.blksize #=> 4096
545
+ # s.atime #=> Wed Apr 09 08:53:54 CDT 2003
546
+ #
547
+ #
548
+
549
+ # Calls IO#tell
550
+ # ario.pos => integer
551
+ # ario.tell => integer
552
+ # Returns the current offset (in bytes) of _ario_.
553
+ #
554
+ # f = rio("testfile")
555
+ # f.pos #=> 0
556
+ # f.gets #=> "This is line one\n"
557
+ # f.pos #=> 17
558
+ #
559
+ #
560
+
561
+ # Calls IO#to_i
562
+ # to_i()
563
+ # Alias for #fileno
564
+ #
565
+ #
566
+
567
+ # Calls IO#to_io
568
+ # ario.to_io -> ios
569
+ # Returns _ario_.
570
+ #
571
+ #
572
+
573
+ # Calls IO#tty?
574
+ # ario.tty? => true or false
575
+ # Returns +true+ if _ario_ is associated with a terminal device (tty),
576
+ # +false+ otherwise.
577
+ #
578
+ # rio("testfile").tty? #=> false
579
+ # rio("/dev/tty").tty? #=> true
580
+ #
581
+ #
582
+ def tty?() target.tty?() end
583
+
584
+ # Calls IO#ungetc
585
+ # ario.ungetc(integer) => ario
586
+ # Pushes back one character (passed as a parameter) onto _ario_, such
587
+ # that a subsequent buffered read will return it. Only one character
588
+ # may be pushed back before a subsequent read operation (that is, you
589
+ # will be able to read only the last of several characters that have
590
+ # been pushed back).
591
+ #
592
+ # f = rio("testfile") #=> #<Rio:testfile>
593
+ # c = f.getc #=> 84
594
+ # f.ungetc(c).getc #=> 84
595
+ #
596
+ def ungetc(*args) target.ungetc(*args); self end
597
+
598
+ end
599
+ end