rio 0.3.4 → 0.3.6

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