rio 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (315) hide show
  1. data/README +14 -8
  2. data/Rakefile +7 -9
  3. data/doc/ANNOUNCE +61 -46
  4. data/doc/RELEASE_NOTES +12 -3
  5. data/doc/RIOIS +7 -7
  6. data/doc/generators/template/html/rio.rb +7 -8
  7. data/doc/generators/template/html/ugly.rb +4 -2
  8. data/doc/pkg_def.rb +4 -10
  9. data/doc/rdoc/classes/Kernel.html +133 -0
  10. data/doc/rdoc/classes/Kernel.src/M000233.html +18 -0
  11. data/doc/rdoc/classes/RIO.html +625 -0
  12. data/doc/rdoc/classes/RIO.src/M000001.html +18 -0
  13. data/doc/rdoc/classes/RIO.src/M000002.html +18 -0
  14. data/doc/rdoc/classes/RIO.src/M000003.html +18 -0
  15. data/doc/rdoc/classes/RIO/Doc.html +148 -0
  16. data/doc/rdoc/classes/RIO/Doc/EXAMPLES.html +432 -0
  17. data/doc/rdoc/classes/RIO/Doc/HOWTO.html +1075 -0
  18. data/doc/rdoc/classes/RIO/Doc/INDEX.html +368 -0
  19. data/doc/rdoc/classes/RIO/Doc/INTRO.html +1533 -0
  20. data/doc/rdoc/classes/RIO/Doc/OPTIONAL.html +221 -0
  21. data/doc/rdoc/classes/RIO/Doc/SYNOPSIS.html +337 -0
  22. data/doc/rdoc/classes/RIO/IF.html +165 -0
  23. data/doc/rdoc/classes/RIO/IF/CSV.html +203 -0
  24. data/doc/rdoc/classes/RIO/IF/CSV.src/M000116.html +19 -0
  25. data/doc/rdoc/classes/RIO/IF/CSV.src/M000117.html +16 -0
  26. data/doc/rdoc/classes/RIO/IF/CSV.src/M000118.html +16 -0
  27. data/doc/rdoc/classes/RIO/IF/Dir.html +343 -0
  28. data/doc/rdoc/classes/RIO/IF/Dir.src/M000045.html +16 -0
  29. data/doc/rdoc/classes/RIO/IF/Dir.src/M000046.html +16 -0
  30. data/doc/rdoc/classes/RIO/IF/Dir.src/M000047.html +16 -0
  31. data/doc/rdoc/classes/RIO/IF/Dir.src/M000048.html +16 -0
  32. data/doc/rdoc/classes/RIO/IF/Dir.src/M000049.html +16 -0
  33. data/doc/rdoc/classes/RIO/IF/Dir.src/M000050.html +16 -0
  34. data/doc/rdoc/classes/RIO/IF/Dir.src/M000051.html +16 -0
  35. data/doc/rdoc/classes/RIO/IF/File.html +223 -0
  36. data/doc/rdoc/classes/RIO/IF/File.src/M000212.html +16 -0
  37. data/doc/rdoc/classes/RIO/IF/File.src/M000213.html +16 -0
  38. data/doc/rdoc/classes/RIO/IF/File.src/M000214.html +16 -0
  39. data/doc/rdoc/classes/RIO/IF/File.src/M000215.html +16 -0
  40. data/doc/rdoc/classes/RIO/IF/FileOrDir.html +572 -0
  41. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000155.html +16 -0
  42. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000156.html +16 -0
  43. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000157.html +16 -0
  44. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000158.html +16 -0
  45. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000159.html +16 -0
  46. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000160.html +16 -0
  47. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000161.html +16 -0
  48. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000162.html +16 -0
  49. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000163.html +16 -0
  50. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000164.html +16 -0
  51. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000165.html +16 -0
  52. data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000166.html +16 -0
  53. data/doc/rdoc/classes/RIO/IF/Grande.html +1349 -0
  54. data/doc/rdoc/classes/RIO/IF/Grande.src/M000088.html +16 -0
  55. data/doc/rdoc/classes/RIO/IF/Grande.src/M000089.html +16 -0
  56. data/doc/rdoc/classes/RIO/IF/Grande.src/M000090.html +16 -0
  57. data/doc/rdoc/classes/RIO/IF/Grande.src/M000091.html +16 -0
  58. data/doc/rdoc/classes/RIO/IF/Grande.src/M000092.html +16 -0
  59. data/doc/rdoc/classes/RIO/IF/Grande.src/M000093.html +21 -0
  60. data/doc/rdoc/classes/RIO/IF/Grande.src/M000094.html +16 -0
  61. data/doc/rdoc/classes/RIO/IF/Grande.src/M000095.html +16 -0
  62. data/doc/rdoc/classes/RIO/IF/Grande.src/M000096.html +16 -0
  63. data/doc/rdoc/classes/RIO/IF/Grande.src/M000097.html +16 -0
  64. data/doc/rdoc/classes/RIO/IF/Grande.src/M000098.html +16 -0
  65. data/doc/rdoc/classes/RIO/IF/Grande.src/M000099.html +16 -0
  66. data/doc/rdoc/classes/RIO/IF/Grande.src/M000100.html +21 -0
  67. data/doc/rdoc/classes/RIO/IF/Grande.src/M000101.html +16 -0
  68. data/doc/rdoc/classes/RIO/IF/Grande.src/M000102.html +16 -0
  69. data/doc/rdoc/classes/RIO/IF/Grande.src/M000103.html +16 -0
  70. data/doc/rdoc/classes/RIO/IF/Grande.src/M000104.html +16 -0
  71. data/doc/rdoc/classes/RIO/IF/Grande.src/M000105.html +16 -0
  72. data/doc/rdoc/classes/RIO/IF/GrandeEntry.html +810 -0
  73. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000106.html +16 -0
  74. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000107.html +16 -0
  75. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000108.html +16 -0
  76. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000109.html +16 -0
  77. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000110.html +16 -0
  78. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000111.html +16 -0
  79. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000112.html +16 -0
  80. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000113.html +16 -0
  81. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000114.html +16 -0
  82. data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000115.html +16 -0
  83. data/doc/rdoc/classes/RIO/IF/GrandeStream.html +1513 -0
  84. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000052.html +16 -0
  85. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000053.html +16 -0
  86. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000054.html +16 -0
  87. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000055.html +16 -0
  88. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000056.html +16 -0
  89. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000057.html +16 -0
  90. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000058.html +16 -0
  91. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000059.html +16 -0
  92. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000060.html +16 -0
  93. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000061.html +16 -0
  94. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000062.html +16 -0
  95. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000063.html +16 -0
  96. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000064.html +16 -0
  97. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000065.html +16 -0
  98. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000066.html +16 -0
  99. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000067.html +16 -0
  100. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000068.html +19 -0
  101. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000069.html +16 -0
  102. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000070.html +16 -0
  103. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000071.html +16 -0
  104. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000072.html +16 -0
  105. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000073.html +16 -0
  106. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000074.html +16 -0
  107. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000075.html +16 -0
  108. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000076.html +16 -0
  109. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000077.html +16 -0
  110. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000078.html +16 -0
  111. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000079.html +16 -0
  112. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000080.html +16 -0
  113. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000081.html +16 -0
  114. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000082.html +16 -0
  115. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000083.html +16 -0
  116. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000084.html +16 -0
  117. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000085.html +16 -0
  118. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000086.html +16 -0
  119. data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000087.html +16 -0
  120. data/doc/rdoc/classes/RIO/IF/Path.html +999 -0
  121. data/doc/rdoc/classes/RIO/IF/Path.src/M000180.html +16 -0
  122. data/doc/rdoc/classes/RIO/IF/Path.src/M000181.html +16 -0
  123. data/doc/rdoc/classes/RIO/IF/Path.src/M000182.html +16 -0
  124. data/doc/rdoc/classes/RIO/IF/Path.src/M000183.html +16 -0
  125. data/doc/rdoc/classes/RIO/IF/Path.src/M000184.html +16 -0
  126. data/doc/rdoc/classes/RIO/IF/Path.src/M000185.html +16 -0
  127. data/doc/rdoc/classes/RIO/IF/Path.src/M000186.html +16 -0
  128. data/doc/rdoc/classes/RIO/IF/Path.src/M000187.html +16 -0
  129. data/doc/rdoc/classes/RIO/IF/Path.src/M000188.html +16 -0
  130. data/doc/rdoc/classes/RIO/IF/Path.src/M000189.html +16 -0
  131. data/doc/rdoc/classes/RIO/IF/Path.src/M000190.html +16 -0
  132. data/doc/rdoc/classes/RIO/IF/Path.src/M000191.html +16 -0
  133. data/doc/rdoc/classes/RIO/IF/Path.src/M000192.html +16 -0
  134. data/doc/rdoc/classes/RIO/IF/Path.src/M000193.html +16 -0
  135. data/doc/rdoc/classes/RIO/IF/Path.src/M000194.html +16 -0
  136. data/doc/rdoc/classes/RIO/IF/Path.src/M000195.html +16 -0
  137. data/doc/rdoc/classes/RIO/IF/Path.src/M000196.html +16 -0
  138. data/doc/rdoc/classes/RIO/IF/Path.src/M000197.html +16 -0
  139. data/doc/rdoc/classes/RIO/IF/Path.src/M000198.html +16 -0
  140. data/doc/rdoc/classes/RIO/IF/Path.src/M000199.html +16 -0
  141. data/doc/rdoc/classes/RIO/IF/Path.src/M000200.html +16 -0
  142. data/doc/rdoc/classes/RIO/IF/Path.src/M000201.html +16 -0
  143. data/doc/rdoc/classes/RIO/IF/Path.src/M000202.html +18 -0
  144. data/doc/rdoc/classes/RIO/IF/Path.src/M000203.html +16 -0
  145. data/doc/rdoc/classes/RIO/IF/Path.src/M000204.html +16 -0
  146. data/doc/rdoc/classes/RIO/IF/Path.src/M000205.html +16 -0
  147. data/doc/rdoc/classes/RIO/IF/Path.src/M000206.html +16 -0
  148. data/doc/rdoc/classes/RIO/IF/Path.src/M000207.html +16 -0
  149. data/doc/rdoc/classes/RIO/IF/Path.src/M000208.html +16 -0
  150. data/doc/rdoc/classes/RIO/IF/Path.src/M000209.html +16 -0
  151. data/doc/rdoc/classes/RIO/IF/Path.src/M000210.html +16 -0
  152. data/doc/rdoc/classes/RIO/IF/Path.src/M000211.html +16 -0
  153. data/doc/rdoc/classes/RIO/IF/RubyIO.html +1414 -0
  154. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000004.html +16 -0
  155. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000005.html +16 -0
  156. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000006.html +16 -0
  157. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000007.html +16 -0
  158. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000008.html +16 -0
  159. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000009.html +16 -0
  160. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000010.html +16 -0
  161. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000011.html +16 -0
  162. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000012.html +16 -0
  163. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000013.html +16 -0
  164. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000014.html +16 -0
  165. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000015.html +16 -0
  166. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000016.html +16 -0
  167. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000017.html +16 -0
  168. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000018.html +16 -0
  169. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000019.html +16 -0
  170. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000020.html +16 -0
  171. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000021.html +16 -0
  172. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000022.html +16 -0
  173. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000023.html +16 -0
  174. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000024.html +16 -0
  175. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000025.html +16 -0
  176. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000026.html +16 -0
  177. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000027.html +16 -0
  178. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000028.html +16 -0
  179. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000029.html +16 -0
  180. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000030.html +16 -0
  181. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000031.html +16 -0
  182. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000032.html +16 -0
  183. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000033.html +16 -0
  184. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000034.html +16 -0
  185. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000035.html +16 -0
  186. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000036.html +16 -0
  187. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000037.html +16 -0
  188. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000038.html +16 -0
  189. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000039.html +16 -0
  190. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000040.html +16 -0
  191. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000041.html +16 -0
  192. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000042.html +16 -0
  193. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000043.html +16 -0
  194. data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000044.html +16 -0
  195. data/doc/rdoc/classes/RIO/IF/String.html +203 -0
  196. data/doc/rdoc/classes/RIO/IF/String.src/M000216.html +16 -0
  197. data/doc/rdoc/classes/RIO/IF/String.src/M000217.html +16 -0
  198. data/doc/rdoc/classes/RIO/IF/String.src/M000218.html +16 -0
  199. data/doc/rdoc/classes/RIO/IF/Test.html +990 -0
  200. data/doc/rdoc/classes/RIO/IF/Test.src/M000119.html +16 -0
  201. data/doc/rdoc/classes/RIO/IF/Test.src/M000120.html +16 -0
  202. data/doc/rdoc/classes/RIO/IF/Test.src/M000121.html +16 -0
  203. data/doc/rdoc/classes/RIO/IF/Test.src/M000122.html +16 -0
  204. data/doc/rdoc/classes/RIO/IF/Test.src/M000123.html +16 -0
  205. data/doc/rdoc/classes/RIO/IF/Test.src/M000124.html +16 -0
  206. data/doc/rdoc/classes/RIO/IF/Test.src/M000125.html +16 -0
  207. data/doc/rdoc/classes/RIO/IF/Test.src/M000126.html +16 -0
  208. data/doc/rdoc/classes/RIO/IF/Test.src/M000127.html +16 -0
  209. data/doc/rdoc/classes/RIO/IF/Test.src/M000128.html +16 -0
  210. data/doc/rdoc/classes/RIO/IF/Test.src/M000129.html +16 -0
  211. data/doc/rdoc/classes/RIO/IF/Test.src/M000130.html +16 -0
  212. data/doc/rdoc/classes/RIO/IF/Test.src/M000131.html +16 -0
  213. data/doc/rdoc/classes/RIO/IF/Test.src/M000132.html +16 -0
  214. data/doc/rdoc/classes/RIO/IF/Test.src/M000133.html +16 -0
  215. data/doc/rdoc/classes/RIO/IF/Test.src/M000134.html +16 -0
  216. data/doc/rdoc/classes/RIO/IF/Test.src/M000135.html +16 -0
  217. data/doc/rdoc/classes/RIO/IF/Test.src/M000136.html +16 -0
  218. data/doc/rdoc/classes/RIO/IF/Test.src/M000137.html +16 -0
  219. data/doc/rdoc/classes/RIO/IF/Test.src/M000138.html +16 -0
  220. data/doc/rdoc/classes/RIO/IF/Test.src/M000139.html +16 -0
  221. data/doc/rdoc/classes/RIO/IF/Test.src/M000140.html +16 -0
  222. data/doc/rdoc/classes/RIO/IF/Test.src/M000141.html +16 -0
  223. data/doc/rdoc/classes/RIO/IF/Test.src/M000142.html +16 -0
  224. data/doc/rdoc/classes/RIO/IF/Test.src/M000143.html +16 -0
  225. data/doc/rdoc/classes/RIO/IF/Test.src/M000144.html +16 -0
  226. data/doc/rdoc/classes/RIO/IF/Test.src/M000145.html +16 -0
  227. data/doc/rdoc/classes/RIO/IF/Test.src/M000146.html +16 -0
  228. data/doc/rdoc/classes/RIO/IF/Test.src/M000147.html +16 -0
  229. data/doc/rdoc/classes/RIO/IF/Test.src/M000148.html +16 -0
  230. data/doc/rdoc/classes/RIO/IF/Test.src/M000149.html +16 -0
  231. data/doc/rdoc/classes/RIO/IF/Test.src/M000150.html +16 -0
  232. data/doc/rdoc/classes/RIO/IF/Test.src/M000151.html +16 -0
  233. data/doc/rdoc/classes/RIO/IF/Test.src/M000152.html +16 -0
  234. data/doc/rdoc/classes/RIO/IF/Test.src/M000153.html +16 -0
  235. data/doc/rdoc/classes/RIO/IF/Test.src/M000154.html +16 -0
  236. data/doc/rdoc/classes/RIO/IF/YAML.html +517 -0
  237. data/doc/rdoc/classes/RIO/IF/YAML.src/M000167.html +19 -0
  238. data/doc/rdoc/classes/RIO/IF/YAML.src/M000168.html +16 -0
  239. data/doc/rdoc/classes/RIO/IF/YAML.src/M000169.html +16 -0
  240. data/doc/rdoc/classes/RIO/IF/YAML.src/M000170.html +16 -0
  241. data/doc/rdoc/classes/RIO/IF/YAML.src/M000171.html +16 -0
  242. data/doc/rdoc/classes/RIO/IF/YAML.src/M000172.html +16 -0
  243. data/doc/rdoc/classes/RIO/IF/YAML.src/M000173.html +16 -0
  244. data/doc/rdoc/classes/RIO/IF/YAML.src/M000174.html +16 -0
  245. data/doc/rdoc/classes/RIO/IF/YAML.src/M000175.html +16 -0
  246. data/doc/rdoc/classes/RIO/IF/YAML.src/M000176.html +16 -0
  247. data/doc/rdoc/classes/RIO/IF/YAML.src/M000177.html +16 -0
  248. data/doc/rdoc/classes/RIO/IF/YAML.src/M000178.html +16 -0
  249. data/doc/rdoc/classes/RIO/IF/YAML.src/M000179.html +16 -0
  250. data/doc/rdoc/classes/RIO/Rio.html +508 -0
  251. data/doc/rdoc/classes/RIO/Rio.src/M000219.html +18 -0
  252. data/doc/rdoc/classes/RIO/Rio.src/M000220.html +20 -0
  253. data/doc/rdoc/classes/RIO/Rio.src/M000221.html +27 -0
  254. data/doc/rdoc/classes/RIO/Rio.src/M000222.html +16 -0
  255. data/doc/rdoc/classes/RIO/Rio.src/M000224.html +19 -0
  256. data/doc/rdoc/classes/RIO/Rio.src/M000225.html +20 -0
  257. data/doc/rdoc/classes/RIO/Rio.src/M000226.html +16 -0
  258. data/doc/rdoc/classes/RIO/Rio.src/M000227.html +16 -0
  259. data/doc/rdoc/classes/RIO/Rio.src/M000228.html +16 -0
  260. data/doc/rdoc/classes/RIO/Rio.src/M000229.html +16 -0
  261. data/doc/rdoc/classes/RIO/Rio.src/M000230.html +16 -0
  262. data/doc/rdoc/classes/RIO/Rio.src/M000231.html +16 -0
  263. data/doc/rdoc/classes/RIO/Rio.src/M000232.html +16 -0
  264. data/doc/rdoc/created.rid +1 -0
  265. data/doc/rdoc/files/README.html +229 -0
  266. data/doc/rdoc/files/lib/rio/constructor_rb.html +141 -0
  267. data/doc/rdoc/files/lib/rio/doc/EXAMPLES_rb.html +134 -0
  268. data/doc/rdoc/files/lib/rio/doc/HOWTO_rb.html +134 -0
  269. data/doc/rdoc/files/lib/rio/doc/INDEX_rb.html +134 -0
  270. data/doc/rdoc/files/lib/rio/doc/INTRO_rb.html +134 -0
  271. data/doc/rdoc/files/lib/rio/doc/OPTIONAL_rb.html +134 -0
  272. data/doc/rdoc/files/lib/rio/doc/SYNOPSIS_rb.html +134 -0
  273. data/doc/rdoc/files/lib/rio/if/basic_rb.html +134 -0
  274. data/doc/rdoc/files/lib/rio/if/csv_rb.html +134 -0
  275. data/doc/rdoc/files/lib/rio/if/dir_rb.html +134 -0
  276. data/doc/rdoc/files/lib/rio/if/file_rb.html +134 -0
  277. data/doc/rdoc/files/lib/rio/if/fileordir_rb.html +134 -0
  278. data/doc/rdoc/files/lib/rio/if/grande_entry_rb.html +134 -0
  279. data/doc/rdoc/files/lib/rio/if/grande_rb.html +141 -0
  280. data/doc/rdoc/files/lib/rio/if/grande_stream_rb.html +134 -0
  281. data/doc/rdoc/files/lib/rio/if/internal_rb.html +134 -0
  282. data/doc/rdoc/files/lib/rio/if/path_rb.html +134 -0
  283. data/doc/rdoc/files/lib/rio/if/rubyio_rb.html +134 -0
  284. data/doc/rdoc/files/lib/rio/if/string_rb.html +134 -0
  285. data/doc/rdoc/files/lib/rio/if/temp_rb.html +134 -0
  286. data/doc/rdoc/files/lib/rio/if/test_rb.html +134 -0
  287. data/doc/rdoc/files/lib/rio/if/yaml_rb.html +134 -0
  288. data/doc/rdoc/files/lib/rio/kernel_rb.html +142 -0
  289. data/doc/rdoc/files/lib/rio_rb.html +153 -0
  290. data/doc/rdoc/fr_class_index.html +49 -0
  291. data/doc/rdoc/fr_file_index.html +51 -0
  292. data/doc/rdoc/fr_method_index.html +259 -0
  293. data/doc/rdoc/index.html +30 -0
  294. data/doc/rdoc/rdoc-style.css +428 -0
  295. data/lib/rio/cp.rb +9 -8
  296. data/lib/rio/doc/HOWTO.rb +46 -32
  297. data/lib/rio/doc/INDEX.rb +311 -0
  298. data/lib/rio/doc/INTRO.rb +10 -10
  299. data/lib/rio/doc/OPTIONAL.rb +6 -9
  300. data/lib/rio/doc/SYNOPSIS.rb +54 -57
  301. data/lib/rio/ext/csv.rb +5 -1
  302. data/lib/rio/ext/yaml.rb +19 -40
  303. data/lib/rio/if/fileordir.rb +1 -1
  304. data/lib/rio/if/grande.rb +4 -4
  305. data/lib/rio/if/grande_entry.rb +6 -0
  306. data/lib/rio/if/grande_stream.rb +10 -8
  307. data/lib/rio/if/path.rb +1 -1
  308. data/lib/rio/if/rubyio.rb +4 -4
  309. data/lib/rio/if/yaml.rb +27 -13
  310. data/lib/rio/ops/stream/input.rb +0 -1
  311. data/lib/rio/stream.rb +1 -0
  312. data/lib/rio/version.rb +1 -1
  313. data/test/tc/synopsis.rb +75 -0
  314. data/test/tc/yaml.rb +150 -4
  315. metadata +314 -2
@@ -0,0 +1,368 @@
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::INDEX</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
+ <meta name="revisit-after" content="5 days">
12
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
13
+ <script type="text/javascript">
14
+ // <![CDATA[
15
+
16
+ function popupCode( url ) {
17
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
18
+ }
19
+
20
+ function toggleCode( id ) {
21
+ if ( document.getElementById )
22
+ elem = document.getElementById( id );
23
+ else if ( document.all )
24
+ elem = eval( "document.all." + id );
25
+ else
26
+ return false;
27
+
28
+ elemStyle = elem.style;
29
+
30
+ if ( elemStyle.display != "block" ) {
31
+ elemStyle.display = "block"
32
+ } else {
33
+ elemStyle.display = "none"
34
+ }
35
+
36
+ return true;
37
+ }
38
+
39
+ // Make codeblocks hidden by default
40
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
41
+
42
+ // ]]>
43
+ </script>
44
+
45
+ </head>
46
+ <body>
47
+
48
+
49
+
50
+ <div id="classHeader">
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td class="class-mod"><strong>Module</strong></td>
54
+ <td class="class-name-in-header">RIO::Doc::INDEX</td>
55
+ <td rowspan="2" class="class-header-space-col"></td>
56
+ <td rowspan="2">
57
+ <a class="in-url" href="../../../files/lib/rio/doc/INDEX_rb.html">
58
+ lib/rio/doc/INDEX.rb
59
+ </a>
60
+ &nbsp;&nbsp;
61
+ </td>
62
+ </tr>
63
+
64
+ </table>
65
+ </div>
66
+ <!-- banner header -->
67
+
68
+ <div id="bodyContent">
69
+
70
+
71
+
72
+ <div id="contextContent">
73
+
74
+ <div id="description">
75
+ <h1>Rio - Index</h1>
76
+ <p>
77
+ Constructors: <a href="../../RIO.html#M000001">RIO#rio</a> <a
78
+ href="../../RIO.html#M000002">RIO#cwd</a> <a
79
+ href="../../RIO.html#M000003">RIO#root</a>
80
+ </p>
81
+ <p>
82
+ Directories: <a href="../IF/Dir.html#M000045">chdir</a> <a
83
+ href="../IF/Dir.html#M000046">find</a> <a
84
+ href="../IF/Dir.html#M000047">glob</a> <a
85
+ href="../IF/Dir.html#M000051">mkdir</a> <a
86
+ href="../IF/Dir.html#M000050">mkpath</a> <a
87
+ href="../IF/Dir.html#M000048">rmdir</a> <a
88
+ href="../IF/Dir.html#M000049">rmtree</a>
89
+ </p>
90
+ <p>
91
+ Files: <a href="../IF/File.html#M000215">clear</a> <a
92
+ href="../IF/File.html#M000212">rm</a> <a
93
+ href="../IF/File.html#M000213">touch</a> <a
94
+ href="../IF/File.html#M000214">truncate</a>
95
+ </p>
96
+ <p>
97
+ Files or Directories: <a href="../IF/FileOrDir.html#M000155">open</a> <a
98
+ href="../IF/FileOrDir.html#M000163">pos</a> <a
99
+ href="../IF/FileOrDir.html#M000165">pos=</a> <a
100
+ href="../IF/FileOrDir.html#M000160">read</a> <a
101
+ href="../IF/FileOrDir.html#M000157">readlink</a> <a
102
+ href="../IF/FileOrDir.html#M000158">rename</a> <a
103
+ href="../IF/FileOrDir.html#M000159">rename!</a> <a
104
+ href="../IF/FileOrDir.html#M000166">reopen</a> <a
105
+ href="../IF/FileOrDir.html#M000161">rewind</a> <a
106
+ href="../IF/FileOrDir.html#M000162">seek</a> <a
107
+ href="../IF/FileOrDir.html#M000156">symlink</a> <a
108
+ href="../IF/FileOrDir.html#M000164">tell</a>
109
+ </p>
110
+ <p>
111
+ Path: <a href="../IF/Path.html#M000202">/</a> <a
112
+ href="../IF/Path.html#M000186">abs</a> <a
113
+ href="../IF/Path.html#M000188">base</a> <a
114
+ href="../IF/Path.html#M000193">basename</a> <a
115
+ href="../IF/Path.html#M000197">basename=</a> <a
116
+ href="../IF/Path.html#M000210">cleanpath</a> <a
117
+ href="../IF/Path.html#M000194">dirname</a> <a
118
+ href="../IF/Path.html#M000198">dirname=</a> <a
119
+ href="../IF/Path.html#M000185">expand_path</a> <a
120
+ href="../IF/Path.html#M000189">ext</a> <a
121
+ href="../IF/Path.html#M000191">ext?</a> <a
122
+ href="../IF/Path.html#M000192">extname</a> <a
123
+ href="../IF/Path.html#M000196">extname=</a> <a
124
+ href="../IF/Path.html#M000195">filename</a> <a
125
+ href="../IF/Path.html#M000199">filename=</a> <a
126
+ href="../IF/Path.html#M000183">fspath</a> <a
127
+ href="../IF/Path.html#M000205">host</a> <a
128
+ href="../IF/Path.html#M000200">join</a> <a
129
+ href="../IF/Path.html#M000203">join!</a> <a
130
+ href="../IF/Path.html#M000207">merge</a> <a
131
+ href="../IF/Path.html#M000190">noext</a> <a
132
+ href="../IF/Path.html#M000206">opaque</a> <a
133
+ href="../IF/Path.html#M000180">path</a> <a
134
+ href="../IF/Path.html#M000211">realpath</a> <a
135
+ href="../IF/Path.html#M000187">rel</a> <a
136
+ href="../IF/Path.html#M000208">route_from</a> <a
137
+ href="../IF/Path.html#M000209">route_to</a> <a
138
+ href="../IF/Path.html#M000204">scheme</a> <a
139
+ href="../IF/Path.html#M000201">splitpath</a> <a
140
+ href="../IF/Path.html#M000182">to_uri</a> <a
141
+ href="../IF/Path.html#M000181">to_url</a> <a
142
+ href="../IF/Path.html#M000184">urlpath</a>
143
+ </p>
144
+ <p>
145
+ String: <a href="../IF/String.html#M000216">+</a> <a
146
+ href="../IF/String.html#M000218">gsub</a> <a
147
+ href="../IF/String.html#M000217">sub</a>
148
+ </p>
149
+ <p>
150
+ Grande: <a href="../IF/Grande.html#M000089">[]</a> <a
151
+ href="../IF/Grande.html#M000100"><</a> <a
152
+ href="../IF/Grande.html#M000098"><<</a> <a
153
+ href="../IF/Grande.html#M000093">></a> <a
154
+ href="../IF/Grande.html#M000096">>></a> <a
155
+ href="../IF/Grande.html#M000095">|</a> <a
156
+ href="../IF/Grande.html#M000099">append_from</a> <a
157
+ href="../IF/Grande.html#M000097">append_to</a> <a
158
+ href="../IF/Grande.html#M000101">copy_from</a> <a
159
+ href="../IF/Grande.html#M000094">copy_to</a> <a
160
+ href="../IF/Grande.html#M000091">delete</a> <a
161
+ href="../IF/Grande.html#M000092">delete!</a> <a
162
+ href="../IF/Grande.html#M000090">each</a> <a
163
+ href="../IF/Grande.html#M000104">empty?</a> <a
164
+ href="../IF/Grande.html#M000102">get</a> <a
165
+ href="../IF/Grande.html#M000103">skip</a> <a
166
+ href="../IF/Grande.html#M000105">split</a> <a
167
+ href="../IF/Grande.html#M000088">to_a</a>
168
+ </p>
169
+ <p>
170
+ Grande Directory: <a href="../IF/GrandeEntry.html#M000113">all</a> <a
171
+ href="../IF/GrandeEntry.html#M000112">all?</a> <a
172
+ href="../IF/GrandeEntry.html#M000106">dirs</a> <a
173
+ href="../IF/GrandeEntry.html#M000108">entries</a> <a
174
+ href="../IF/GrandeEntry.html#M000110">files</a> <a
175
+ href="../IF/GrandeEntry.html#M000115">norecurse</a> <a
176
+ href="../IF/GrandeEntry.html#M000114">recurse</a> <a
177
+ href="../IF/GrandeEntry.html#M000107">skipdirs</a> <a
178
+ href="../IF/GrandeEntry.html#M000109">skipentries</a> <a
179
+ href="../IF/GrandeEntry.html#M000111">skipfiles</a>
180
+ </p>
181
+ <p>
182
+ Grande Stream: <a href="../IF/GrandeStream.html#M000068">+@</a> <a
183
+ href="../IF/GrandeStream.html#M000067">a</a> <a
184
+ href="../IF/GrandeStream.html#M000069">a!</a> <a
185
+ href="../IF/GrandeStream.html#M000056">bytes</a> <a
186
+ href="../IF/GrandeStream.html#M000082">chomp</a> <a
187
+ href="../IF/GrandeStream.html#M000081">chomp?</a> <a
188
+ href="../IF/GrandeStream.html#M000077">closeoncopy</a> <a
189
+ href="../IF/GrandeStream.html#M000079">closeoncopy?</a> <a
190
+ href="../IF/GrandeStream.html#M000074">closeoneof</a> <a
191
+ href="../IF/GrandeStream.html#M000076">closeoneof?</a> <a
192
+ href="../IF/GrandeStream.html#M000065">contents</a> <a
193
+ href="../IF/GrandeStream.html#M000064">getline</a> <a
194
+ href="../IF/GrandeStream.html#M000062">getrec</a> <a
195
+ href="../IF/GrandeStream.html#M000063">getrow</a> <a
196
+ href="../IF/GrandeStream.html#M000085">gzip</a> <a
197
+ href="../IF/GrandeStream.html#M000086">gzip?</a> <a
198
+ href="../IF/GrandeStream.html#M000052">line</a> <a
199
+ href="../IF/GrandeStream.html#M000055">lines</a> <a
200
+ href="../IF/GrandeStream.html#M000080">noautoclose</a> <a
201
+ href="../IF/GrandeStream.html#M000078">nocloseoncopy</a> <a
202
+ href="../IF/GrandeStream.html#M000075">nocloseoneof</a> <a
203
+ href="../IF/GrandeStream.html#M000066">putrec</a> <a
204
+ href="../IF/GrandeStream.html#M000070">r</a> <a
205
+ href="../IF/GrandeStream.html#M000071">r!</a> <a
206
+ href="../IF/GrandeStream.html#M000053">record</a> <a
207
+ href="../IF/GrandeStream.html#M000057">records</a> <a
208
+ href="../IF/GrandeStream.html#M000054">row</a> <a
209
+ href="../IF/GrandeStream.html#M000060">rows</a> <a
210
+ href="../IF/GrandeStream.html#M000059">skiplines</a> <a
211
+ href="../IF/GrandeStream.html#M000058">skiprecords</a> <a
212
+ href="../IF/GrandeStream.html#M000061">skiprows</a> <a
213
+ href="../IF/GrandeStream.html#M000087">splitlines</a> <a
214
+ href="../IF/GrandeStream.html#M000084">strip</a> <a
215
+ href="../IF/GrandeStream.html#M000083">strip?</a> <a
216
+ href="../IF/GrandeStream.html#M000072">w</a> <a
217
+ href="../IF/GrandeStream.html#M000073">w!</a>
218
+ </p>
219
+ <p>
220
+ Ruby I/O: <a href="../IF/RubyIO.html#M000008">binmode</a> <a
221
+ href="../IF/RubyIO.html#M000030">close</a> <a
222
+ href="../IF/RubyIO.html#M000031">close_write</a> <a
223
+ href="../IF/RubyIO.html#M000010">each_byte</a> <a
224
+ href="../IF/RubyIO.html#M000011">each_line</a> <a
225
+ href="../IF/RubyIO.html#M000025">eof?</a> <a
226
+ href="../IF/RubyIO.html#M000032">fcntl</a> <a
227
+ href="../IF/RubyIO.html#M000034">fileno</a> <a
228
+ href="../IF/RubyIO.html#M000009">flush</a> <a
229
+ href="../IF/RubyIO.html#M000035">fsync</a> <a
230
+ href="../IF/RubyIO.html#M000037">getc</a> <a
231
+ href="../IF/RubyIO.html#M000004">gets</a> <a
232
+ href="../IF/RubyIO.html#M000033">ioctl</a> <a
233
+ href="../IF/RubyIO.html#M000026">ioh</a> <a
234
+ href="../IF/RubyIO.html#M000027">ios</a> <a
235
+ href="../IF/RubyIO.html#M000005">lineno</a> <a
236
+ href="../IF/RubyIO.html#M000006">lineno=</a> <a
237
+ href="../IF/RubyIO.html#M000028">mode</a> <a
238
+ href="../IF/RubyIO.html#M000029">mode?</a> <a
239
+ href="../IF/RubyIO.html#M000043">nosync</a> <a
240
+ href="../IF/RubyIO.html#M000036">pid</a> <a
241
+ href="../IF/RubyIO.html#M000015">print</a> <a
242
+ href="../IF/RubyIO.html#M000016">print!</a> <a
243
+ href="../IF/RubyIO.html#M000018">printf</a> <a
244
+ href="../IF/RubyIO.html#M000017">printf!</a> <a
245
+ href="../IF/RubyIO.html#M000020">putc</a> <a
246
+ href="../IF/RubyIO.html#M000019">putc!</a> <a
247
+ href="../IF/RubyIO.html#M000021">puts</a> <a
248
+ href="../IF/RubyIO.html#M000022">puts!</a> <a
249
+ href="../IF/RubyIO.html#M000013">readline</a> <a
250
+ href="../IF/RubyIO.html#M000012">readlines</a> <a
251
+ href="../IF/RubyIO.html#M000014">readpartial</a> <a
252
+ href="../IF/RubyIO.html#M000007">recno</a> <a
253
+ href="../IF/RubyIO.html#M000042">sync</a> <a
254
+ href="../IF/RubyIO.html#M000044">sync?</a> <a
255
+ href="../IF/RubyIO.html#M000038">to_i</a> <a
256
+ href="../IF/RubyIO.html#M000039">to_io</a> <a
257
+ href="../IF/RubyIO.html#M000040">tty?</a> <a
258
+ href="../IF/RubyIO.html#M000041">ungetc</a> <a
259
+ href="../IF/RubyIO.html#M000024">write</a> <a
260
+ href="../IF/RubyIO.html#M000023">write!</a>
261
+ </p>
262
+ <p>
263
+ Test: <a href="../IF/Test.html#M000151">abs?</a> <a
264
+ href="../IF/Test.html#M000152">absolute?</a> <a
265
+ href="../IF/Test.html#M000134">atime</a> <a
266
+ href="../IF/Test.html#M000119">blockdev?</a> <a
267
+ href="../IF/Test.html#M000120">chardev?</a> <a
268
+ href="../IF/Test.html#M000128">closed?</a> <a
269
+ href="../IF/Test.html#M000135">ctime</a> <a
270
+ href="../IF/Test.html#M000122">dir?</a> <a
271
+ href="../IF/Test.html#M000121">directory?</a> <a
272
+ href="../IF/Test.html#M000138">executable_real?</a> <a
273
+ href="../IF/Test.html#M000137">executable?</a> <a
274
+ href="../IF/Test.html#M000123">exist?</a> <a
275
+ href="../IF/Test.html#M000124">file?</a> <a
276
+ href="../IF/Test.html#M000129">fnmatch?</a> <a
277
+ href="../IF/Test.html#M000130">ftype</a> <a
278
+ href="../IF/Test.html#M000145">grpowned?</a> <a
279
+ href="../IF/Test.html#M000132">lstat</a> <a
280
+ href="../IF/Test.html#M000153">mountpoint?</a> <a
281
+ href="../IF/Test.html#M000136">mtime</a> <a
282
+ href="../IF/Test.html#M000127">open?</a> <a
283
+ href="../IF/Test.html#M000144">owned?</a> <a
284
+ href="../IF/Test.html#M000133">pipe?</a> <a
285
+ href="../IF/Test.html#M000140">readable_real?</a> <a
286
+ href="../IF/Test.html#M000139">readable?</a> <a
287
+ href="../IF/Test.html#M000154">root?</a> <a
288
+ href="../IF/Test.html#M000146">setgid?</a> <a
289
+ href="../IF/Test.html#M000147">setuid?</a> <a
290
+ href="../IF/Test.html#M000148">size</a> <a
291
+ href="../IF/Test.html#M000149">size?</a> <a
292
+ href="../IF/Test.html#M000125">socket?</a> <a
293
+ href="../IF/Test.html#M000131">stat</a> <a
294
+ href="../IF/Test.html#M000143">sticky?</a> <a
295
+ href="../IF/Test.html#M000126">symlink?</a> <a
296
+ href="../IF/Test.html#M000142">writable_real?</a> <a
297
+ href="../IF/Test.html#M000141">writable?</a> <a
298
+ href="../IF/Test.html#M000150">zero?</a>
299
+ </p>
300
+ <p>
301
+ Basic: <a href="../Rio.html#M000228">RIO::Rio#==</a> <a
302
+ href="../Rio.html#M000229">RIO::Rio#===</a> <a
303
+ href="../Rio.html#M000232">RIO::Rio#=~</a> <a
304
+ href="../Rio.html#M000224">RIO::Rio#dup</a> <a
305
+ href="../Rio.html#M000231">RIO::Rio#eql?</a> <a
306
+ href="../Rio.html#M000230">RIO::Rio#hash</a> <a
307
+ href="../Rio.html#M000220">RIO::Rio#initialize_copy</a> <a
308
+ href="../Rio.html#M000225">RIO::Rio#inspect</a> <a
309
+ href="../Rio.html#M000227">RIO::Rio#length</a> <a
310
+ href="../Rio.html#M000219">RIO::Rio#new</a> <a
311
+ href="../Rio.html#M000221">RIO::Rio#rio</a> <a
312
+ href="../Rio.html#M000226">RIO::Rio#string</a> <a
313
+ href="../Rio.html#M000222">RIO::Rio#to_s</a> <a
314
+ href="../Rio.html#M000223">RIO::Rio#to_str</a>
315
+ </p>
316
+ <p>
317
+ CSV: <a href="../IF/CSV.html#M000117">columns</a> <a
318
+ href="../IF/CSV.html#M000116">csv</a> <a
319
+ href="../IF/CSV.html#M000118">skipcolumns</a>
320
+ </p>
321
+ <p>
322
+ YAML: <a href="../IF/YAML.html#M000174">document</a> <a
323
+ href="../IF/YAML.html#M000171">documents</a> <a
324
+ href="../IF/YAML.html#M000179">dump</a> <a
325
+ href="../IF/YAML.html#M000175">getobj</a> <a
326
+ href="../IF/YAML.html#M000176">load</a> <a
327
+ href="../IF/YAML.html#M000173">object</a> <a
328
+ href="../IF/YAML.html#M000169">objects</a> <a
329
+ href="../IF/YAML.html#M000177">putobj</a> <a
330
+ href="../IF/YAML.html#M000178">putobj!</a> <a
331
+ href="../IF/YAML.html#M000172">skipdocuments</a> <a
332
+ href="../IF/YAML.html#M000170">skipobjects</a> <a
333
+ href="../IF/YAML.html#M000167">yaml</a> <a
334
+ href="../IF/YAML.html#M000168">yaml?</a>
335
+ </p>
336
+
337
+ </div>
338
+
339
+
340
+ </div>
341
+
342
+
343
+
344
+
345
+ <!-- if includes -->
346
+
347
+ <div id="section">
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+ <!-- if method_list -->
357
+ </div>
358
+
359
+
360
+ </div>
361
+
362
+
363
+ <div id="validator-badges">
364
+ <p><small>Copyright &copy; 2005,2006,2007 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
365
+ </div>
366
+
367
+ </body>
368
+ </html>
@@ -0,0 +1,1533 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: RIO::Doc::INTRO</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <meta name="revisit-after" content="5 days">
12
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
13
+ <script type="text/javascript">
14
+ // <![CDATA[
15
+
16
+ function popupCode( url ) {
17
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
18
+ }
19
+
20
+ function toggleCode( id ) {
21
+ if ( document.getElementById )
22
+ elem = document.getElementById( id );
23
+ else if ( document.all )
24
+ elem = eval( "document.all." + id );
25
+ else
26
+ return false;
27
+
28
+ elemStyle = elem.style;
29
+
30
+ if ( elemStyle.display != "block" ) {
31
+ elemStyle.display = "block"
32
+ } else {
33
+ elemStyle.display = "none"
34
+ }
35
+
36
+ return true;
37
+ }
38
+
39
+ // Make codeblocks hidden by default
40
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
41
+
42
+ // ]]>
43
+ </script>
44
+
45
+ </head>
46
+ <body>
47
+
48
+
49
+
50
+ <div id="classHeader">
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td class="class-mod"><strong>Module</strong></td>
54
+ <td class="class-name-in-header">RIO::Doc::INTRO</td>
55
+ <td rowspan="2" class="class-header-space-col"></td>
56
+ <td rowspan="2">
57
+ <a class="in-url" href="../../../files/lib/rio/doc/INTRO_rb.html">
58
+ lib/rio/doc/INTRO.rb
59
+ </a>
60
+ &nbsp;&nbsp;
61
+ </td>
62
+ </tr>
63
+
64
+ </table>
65
+ </div>
66
+ <!-- banner header -->
67
+
68
+ <div id="bodyContent">
69
+
70
+
71
+
72
+ <div id="contextContent">
73
+
74
+ <div id="description">
75
+ <h1>Rio - Ruby I/O Facilitator</h1>
76
+ <p>
77
+ fa-cil-i-tate: To make easy or easier [<a
78
+ href="http://www.thefreedictionary.com/facilitate">www.thefreedictionary.com/facilitate</a>]
79
+ </p>
80
+ <p>
81
+ Rio is a facade for most of the standard ruby classes that deal with I/O;
82
+ providing a simple, intuitive, succinct interface to the functionality
83
+ provided by IO, File, Dir, Pathname, FileUtils, Tempfile, StringIO, OpenURI
84
+ and others. Rio also provides an application level interface which allows
85
+ many common I/O idioms to be expressed succinctly.
86
+ </p>
87
+ <p>
88
+ Rio functionality can be broadly broken into three categories
89
+ </p>
90
+ <ul>
91
+ <li>path manipulation
92
+
93
+ </li>
94
+ <li>file system access
95
+
96
+ </li>
97
+ <li>stream manipulation
98
+
99
+ </li>
100
+ </ul>
101
+ <p>
102
+ Which methods are available to a given Rio, depends on the underlying
103
+ object.
104
+ </p>
105
+ <p>
106
+ A Rio generally does not need to be opened or have its mode specified. Most
107
+ of Rio&#8217;s methods simply configure it. When an actual IO operation is
108
+ specified, Rio determines how to open it based on the object it is opening,
109
+ the operation it is performing, and the options specified.
110
+ </p>
111
+ <p>
112
+ Rio configuration methods return the Rio for easy chaining and regard the
113
+ presence of a block as an implied <tt>each</tt>.
114
+ </p>
115
+ <h2>Using a Rio</h2>
116
+ <p>
117
+ Using a Rio can be described as having 3 steps:
118
+ </p>
119
+ <ul>
120
+ <li>Creating a Rio
121
+
122
+ </li>
123
+ <li>Configuring a Rio
124
+
125
+ </li>
126
+ <li>Rio I/O
127
+
128
+ </li>
129
+ </ul>
130
+ <h3>Creating a Rio</h3>
131
+ <p>
132
+ Rio extends <a href="../../Kernel.html">Kernel</a> with one function
133
+ <tt>rio</tt>, its constructor. This function is overloaded to create any
134
+ type of Rio. <tt>rio</tt> looks at the class and sometimes the value of its
135
+ first argument to create an internal representation of the resource
136
+ specified, additional arguments are used as needed by the resource type.
137
+ The rio constructor does not initiate any io, it does not check for a
138
+ resources existance or type. It neither knows nor cares what can be done
139
+ with this Rio. Using methods like <tt>respond_to?</tt> are meaningless at
140
+ best and usually misleading.
141
+ </p>
142
+ <p>
143
+ For purposes of discussion, we divide Rios into two catagories, those that
144
+ have a path and those that don&#8217;t.
145
+ </p>
146
+ <h4>Creating a Rio that has a path</h4>
147
+ <p>
148
+ To create a Rio that has a path the arguments to <tt>rio</tt> may be:
149
+ </p>
150
+ <ul>
151
+ <li>a string representing the entire path. The separator used for Rios is as
152
+ specified in RFC1738 (&#8217;/&#8217;).
153
+
154
+ <pre>
155
+ rio('adir/afile')
156
+ </pre>
157
+ </li>
158
+ <li>a string representing a fully qualified <tt>file</tt> URI as per RFC1738
159
+
160
+ <pre>
161
+ rio('file:///atopleveldir/adir/afile')
162
+ </pre>
163
+ </li>
164
+ <li>a <tt>URI</tt> object representing a <tt>file</tt> or generic <tt>URI</tt>
165
+
166
+ <pre>
167
+ rio(URI('adir/afile'))
168
+ </pre>
169
+ </li>
170
+ <li>the components of a path as separate arguments
171
+
172
+ <pre>
173
+ rio('adir','afile')
174
+ </pre>
175
+ </li>
176
+ <li>the components of a path as an array
177
+
178
+ <pre>
179
+ rio(%w/adir afile/)
180
+ </pre>
181
+ </li>
182
+ <li>another Rio
183
+
184
+ <pre>
185
+ another_rio = rio('adir/afile')
186
+ rio(another_rio)
187
+ </pre>
188
+ </li>
189
+ <li>any object whose <tt>to_s</tt> method returns one of the above
190
+
191
+ <pre>
192
+ rio(Pathname.new('apath'))
193
+ </pre>
194
+ </li>
195
+ <li>any combination of the above either as separate arguments or as elements of
196
+ an array,
197
+
198
+ <pre>
199
+ another_rio = rio('dir1/dir2')
200
+ auri = URI('dir4/dir5)
201
+ rio(another_rio,'dir3',auri,'dir6/dir7')
202
+ </pre>
203
+ </li>
204
+ </ul>
205
+ <h5>Creating a Rio that refers to a web page</h5>
206
+ <p>
207
+ To create a Rio that refers to a web page the arguments to <tt>rio</tt> may
208
+ be:
209
+ </p>
210
+ <ul>
211
+ <li>a string representing a fully qualified <tt>http</tt> URI
212
+
213
+ <pre>
214
+ rio('http://ruby-doc.org/index.html')
215
+ </pre>
216
+ </li>
217
+ <li>a <tt>URI</tt> object representing a <tt>http</tt> <tt>URI</tt>
218
+
219
+ <pre>
220
+ rio(URI('http://ruby-doc.org/index.html'))
221
+ </pre>
222
+ </li>
223
+ <li>either of the above with additional path elements
224
+
225
+ <pre>
226
+ rio('http://www.ruby-doc.org/','core','classes/Object.html')
227
+ </pre>
228
+ </li>
229
+ </ul>
230
+ <h5>Creating a Rio that refers to a file or directory on a FTP server</h5>
231
+ <p>
232
+ To create a Rio that refers to a file on a FTP server the arguments to
233
+ <tt>rio</tt> may be:
234
+ </p>
235
+ <ul>
236
+ <li>a string representing a fully qualified <tt>ftp</tt> URI
237
+
238
+ <pre>
239
+ rio('ftp://user:password@ftp.example.com/afile.tar.gz')
240
+ </pre>
241
+ </li>
242
+ <li>a <tt>URI</tt> object representing a <tt>ftp</tt> <tt>URI</tt>
243
+
244
+ <pre>
245
+ rio(URI('ftp://ftp.example.com/afile.tar.gz'))
246
+ </pre>
247
+ </li>
248
+ <li>either of the above with additional path elements
249
+
250
+ <pre>
251
+ rio('ftp://ftp.gnu.org/pub/gnu','emacs','windows','README')
252
+ </pre>
253
+ </li>
254
+ </ul>
255
+ <h4>Creating Rios that do not have a path</h4>
256
+ <p>
257
+ To create a Rio without a path, the first argument to <tt>rio</tt> is
258
+ usually a single character.
259
+ </p>
260
+ <h5>Creating a Rio that refers to a clone of your programs stdin or stdout.</h5>
261
+ <p>
262
+ <tt>rio(?-)</tt> (mnemonic: &#8217;-&#8217; is used by some Unix programs
263
+ to specify stdin or stdout in place of a file)
264
+ </p>
265
+ <p>
266
+ Just as a Rio that refers to a file, does not know whether that file will
267
+ be opened for reading or writing until an io operation is specified, a
268
+ <tt>stdio:</tt> Rio does not know whether it will connect to stdin or
269
+ stdout until an I/O operation is specified.
270
+ </p>
271
+ <h5>Creating a Rio that refers to a clone of your programs stderr.</h5>
272
+ <p>
273
+ <tt>rio(?=)</tt> (mnemonic: &#8217;-&#8217; refers to fileno 1, so
274
+ &#8217;=&#8217; refers to fileno 2)
275
+ </p>
276
+ <h5>Creating a Rio that refers to an arbitrary IO object.</h5>
277
+ <pre>
278
+ an_io = ::File.new('afile')
279
+ rio(an_io)
280
+ </pre>
281
+ <h5>Creating a Rio that refers to a file descriptor</h5>
282
+ <p>
283
+ <tt>rio(?#,fd)</tt> (mnemonic: a file descriptor is a number
284
+ &#8217;#&#8217; )
285
+ </p>
286
+ <pre>
287
+ an_io = ::File.new('afile')
288
+ rio(an_io)
289
+ </pre>
290
+ <h5>Creating a Rio that refers to a StringIO object</h5>
291
+ <p>
292
+ <tt>rio(?&quot;)</tt> (mnemonic: &#8217;&quot;&#8217; surrounds strings)
293
+ </p>
294
+ <ul>
295
+ <li>create a Rio that refers to its own string
296
+
297
+ </li>
298
+ </ul>
299
+ <pre>
300
+ rio(?&quot;)
301
+ </pre>
302
+ <ul>
303
+ <li>create a Rio that refers to a string of your choosing
304
+
305
+ </li>
306
+ </ul>
307
+ <pre>
308
+ astring = &quot;&quot;
309
+ rio(?&quot;,astring)
310
+ </pre>
311
+ <h5>Creating a Rio that refers to a Temporary object</h5>
312
+ <p>
313
+ <tt>rio(??)</tt> (mnemonic: &#8217;?&#8217; you don&#8217;t know its name)
314
+ </p>
315
+ <p>
316
+ To create a temporary object that will become a file or a directory,
317
+ depending on how you use it:
318
+ </p>
319
+ <pre>
320
+ rio(??)
321
+ rio(??,basename='rio',tmpdir=Dir::tmpdir)
322
+ </pre>
323
+ <p>
324
+ To force it to become a directory:
325
+ </p>
326
+ <pre>
327
+ rio(??).mkdir
328
+ </pre>
329
+ <p>
330
+ or
331
+ </p>
332
+ <pre>
333
+ rio(??).chdir
334
+ </pre>
335
+ <h5>Creating a Rio that refers to an arbitrary TCPSocket</h5>
336
+ <pre>
337
+ rio('tcp:',hostname,port)
338
+ </pre>
339
+ <p>
340
+ or
341
+ </p>
342
+ <pre>
343
+ rio('tcp://hostname:port')
344
+ </pre>
345
+ <h5>Creating a Rio that runs an external program and connects to its stdin and stdout</h5>
346
+ <p>
347
+ <tt>rio(?-,cmd)</tt> (mnemonic: &#8217;-&#8217; is used by some Unix
348
+ programs to specify stdin or stdout in place of a file)
349
+ </p>
350
+ <p>
351
+ or
352
+ </p>
353
+ <p>
354
+ <tt>rio(?`,cmd)</tt> (mnemonic: &#8217;`&#8217; (backtick) runs an external
355
+ program in ruby)
356
+ </p>
357
+ <p>
358
+ This is Rio&#8217;s interface to IO#popen
359
+ </p>
360
+ <h3>Path Manipulation</h3>
361
+ <p>
362
+ Rio&#8217;s path manipulation methods are for the most part simply
363
+ forwarded to the File or URI classes with the return values converted to a
364
+ Rio.
365
+ </p>
366
+ <h4>Creating a Rio from a Rio&#8217;s component parts.</h4>
367
+ <p>
368
+ The Rio methods for creating a Rio from a Rio&#8217;s component parts are
369
+ <a href="../IF/Path.html#M000194">dirname</a>, <a
370
+ href="../IF/Path.html#M000195">filename</a>, <a
371
+ href="../IF/Path.html#M000193">basename</a>, and <a
372
+ href="../IF/Path.html#M000192">extname</a>. The behavior of <a
373
+ href="../IF/Path.html#M000193">basename</a> depends on the setting of the
374
+ <tt>ext</tt> configuration variable and is different from its counterpart
375
+ in the File class. The default value of the <tt>ext</tt> configuration
376
+ variable is the string returned File#extname. The <tt>ext</tt>
377
+ configuration variable can be changed using <a
378
+ href="../IF/Path.html#M000189">ext</a> and <a
379
+ href="../IF/Path.html#M000190">noext</a> and can be queried using <a
380
+ href="../IF/Path.html#M000191">ext?</a>. This value is used by calls to <a
381
+ href="../IF/Path.html#M000193">basename</a>.
382
+ </p>
383
+ <p>
384
+ <a href="../IF/Path.html#M000195">filename</a> returns the last component
385
+ of a path, and is basically the same as <tt>basename</tt> without
386
+ consideration of an extension.
387
+ </p>
388
+ <pre>
389
+ rio('afile.txt').basename #=&gt; rio('afile')
390
+ rio('afile.txt').filename #=&gt; rio('afile.txt')
391
+
392
+ ario = rio('afile.tar.gz')
393
+ ario.basename #=&gt; rio('afile.tar')
394
+ ario.ext? #=&gt; &quot;.gz&quot;
395
+ ario.ext('.tar.gz').basename #=&gt; rio('afile')
396
+ ario.ext? #=&gt; &quot;.tar.gz&quot;
397
+ </pre>
398
+ <h4>Changing a path&#8217;s component parts.</h4>
399
+ <p>
400
+ Rio also provides methods for changing the component parts of its path.
401
+ They are <a href="../IF/Path.html#M000198">dirname=</a>, <a
402
+ href="../IF/Path.html#M000199">filename=</a>, <a
403
+ href="../IF/Path.html#M000197">basename=</a>, and <a
404
+ href="../IF/Path.html#M000196">extname=</a>. These methods replace the part
405
+ extracted as described above with their argument.
406
+ </p>
407
+ <pre>
408
+ ario = rio('dirA/dirB/afile.rb')
409
+ ario.dirname = 'dirC' # rio('dirC/afile.rb')
410
+ ario.basename = 'bfile' # rio('dirC/bfile.rb')
411
+ ario.extname = '.txt' # rio('dirC/bfile.txt')
412
+ ario.filename = 'cfile.rb' # rio('dirC/cfile.rb')
413
+ </pre>
414
+ <p>
415
+ Rio also has a <tt>rename</tt> mode which causes each of these to rename
416
+ the actual file system object as well as changing the Rio. This is
417
+ discussed in the section on Renaming and Moving.
418
+ </p>
419
+ <h4>Splitting a Rio</h4>
420
+ <p>
421
+ <a href="../IF/Grande.html#M000105">split</a> (or <a
422
+ href="../IF/Path.html#M000201">splitpath</a>) returns an array of Rios, one
423
+ for each path element. (Note that this behavior differs from File#split.)
424
+ </p>
425
+ <pre>
426
+ rio('a/b/c').split #=&gt; [rio('a'),rio('b'),rio('c')]
427
+ </pre>
428
+ <p>
429
+ The array returned is extended with a <tt>to_rio</tt> method, which will
430
+ put the parts back together again.
431
+ </p>
432
+ <pre>
433
+ ary = rio('a/b/c').split #=&gt; [rio('a'),rio('b'),rio('c')]
434
+ ary.to_rio #=&gt; rio('a/b/c')
435
+ </pre>
436
+ <h4>Creating a Rio by specifying the individual parts of its path</h4>
437
+ <p>
438
+ The first way to create a Rio by specifying its parts is to use the Rio
439
+ constructor <a href="../Rio.html#M000221">Rio#rio</a>. Since a Rio is among
440
+ the arguments the constructor will take, the constructor can be used.
441
+ </p>
442
+ <pre>
443
+ ario = rio('adir')
444
+ rio(ario,'b') #=&gt; rio('adir/b')
445
+ </pre>
446
+ <p>
447
+ <a href="../IF/Path.html#M000200">join</a> and <a
448
+ href="../IF/Path.html#M000202">/</a> do the same thing, but the operator
449
+ version <tt>/</tt> can take only one argument.
450
+ </p>
451
+ <pre>
452
+ a = rio('a')
453
+ b = rio('b')
454
+ c = a.join(b) #=&gt; rio('a/b')
455
+ c = a/b #=&gt; rio('a/b')
456
+ </pre>
457
+ <p>
458
+ The arguments to <a href="../IF/Path.html#M000200">join</a> and <a
459
+ href="../IF/Path.html#M000202">/</a> do not need to be Rios, of course
460
+ </p>
461
+ <pre>
462
+ ario = rio('adir')
463
+ ario/'afile.rb' #=&gt; rio('adir/afile.rb')
464
+ ario.join('b','c','d') #=&gt; rio('adir/b/c/d')
465
+ ario/'b'/'c'/'d' #=&gt; rio('adir/b/c/d')
466
+ ario /= 'e' #=&gt; rio('adir/b/c/d/e')
467
+ </pre>
468
+ <h4>Manipulating a Rio path by treating it as a string.</h4>
469
+ <p>
470
+ The Rio methods which treat a Rio as a string are <a
471
+ href="../IF/String.html#M000217">sub</a>, <a
472
+ href="../IF/String.html#M000218">gsub</a> and <a
473
+ href="../IF/String.html#M000216">+</a>. These methods create a new Rio
474
+ using the string created by forwarding the method to the String returned by
475
+ <a href="../Rio.html#M000222">Rio#to_s</a>.
476
+ </p>
477
+ <pre>
478
+ ario = rio('dirA/dirB/afile') + '-1.1.1' # rio('dirA/dirB/afile-1.1.1')
479
+ brio = ario.sub(/^dirA/, 'dirC') # rio('dirC/dirB/afile-1.1.1')
480
+ </pre>
481
+ <h4>Creating a Rio based on its relationship to another</h4>
482
+ <p>
483
+ <a href="../IF/Path.html#M000186">abs</a> creates a new rio whose path is
484
+ the absolute path of a Rio. If called with an argument, it uses it as the
485
+ base path, otherwise it uses an internal base path (usually the current
486
+ working directory when it was created).
487
+ </p>
488
+ <pre>
489
+ rio('/tmp').chdir do
490
+ rio('a').abs #=&gt; rio('/tmp/a')
491
+ rio('a').abs('/usr') #=&gt; rio('/usr/a')
492
+ end
493
+ </pre>
494
+ <p>
495
+ <a href="../IF/Path.html#M000187">rel</a> creates a new rio with a path
496
+ relative to a Rio.
497
+ </p>
498
+ <pre>
499
+ rio('/tmp').chdir do
500
+ rio('/tmp/a').rel #=&gt; rio('a')
501
+ end
502
+ rio('/tmp/b').rel('/tmp') #=&gt; rio('b')
503
+ </pre>
504
+ <p>
505
+ <a href="../IF/Path.html#M000209">route_to</a> and <a
506
+ href="../IF/Path.html#M000208">route_from</a> creates a new rio with a path
507
+ representing the route to get to/from a Rio. They are based on the methods
508
+ of the same names in the ::URI class
509
+ </p>
510
+ <h3>Configuring a Rio</h3>
511
+ <p>
512
+ The second step in using a rio is configuring it. Note that many times no
513
+ configuration is necessary and that this is not a comprehensive list of all
514
+ of Rio&#8217;s configuration methods.
515
+ </p>
516
+ <p>
517
+ Rio&#8217;s configuration mehods fall into three categories.
518
+ </p>
519
+ <ul>
520
+ <li>I/O manipulators
521
+
522
+ <p>
523
+ An I/O manipulator alters the behavior of a Rio&#8217;s underlying IO
524
+ object. These affect the behaviour of I/O methods which are forwarded
525
+ directly to the underlying object as well as the grande I/O methods.
526
+ </p>
527
+ </li>
528
+ <li>Grande configuration methods
529
+
530
+ <p>
531
+ The grande configuration methods affect the behaviour of Rio&#8217;s grande
532
+ I/O methods
533
+ </p>
534
+ </li>
535
+ <li>Grande selection methods
536
+
537
+ <p>
538
+ The grande selection methods select what data is returned by Rio&#8217;s
539
+ grande I/O methods
540
+ </p>
541
+ </li>
542
+ </ul>
543
+ <p>
544
+ All of Rio&#8217;s configuration and selection methods can be passed a
545
+ block, which will cause the Rio to behave as if <a
546
+ href="../IF/Grande.html#M000090">each</a> had been called with the block
547
+ after the method.
548
+ </p>
549
+ <h4>IO manipulators</h4>
550
+ <ul>
551
+ <li><tt>gzip</tt> a file on output, and ungzip it on input
552
+
553
+ <pre>
554
+ rio('afile.gz').gzip
555
+ </pre>
556
+ <p>
557
+ This causes the rio to read through a Zlib::GzipReader and to write
558
+ Zlib::GzipWriter.
559
+ </p>
560
+ </li>
561
+ <li><tt>chomp</tt> lines as they are read
562
+
563
+ <pre>
564
+ rio('afile').chomp
565
+ </pre>
566
+ <p>
567
+ This causes a Rio to call String#chomp on the the String returned by all
568
+ line oriented read operations.
569
+ </p>
570
+ </li>
571
+ </ul>
572
+ <h4>Grande configuration methods</h4>
573
+ <ul>
574
+ <li><tt>all</tt>, <tt>recurse</tt>, <tt>norecurse</tt>
575
+
576
+ <pre>
577
+ rio('adir').all
578
+ rio('adir').norecurse('CVS')
579
+ </pre>
580
+ <p>
581
+ These methods instruct the Rio to also include entries in subdirectories
582
+ when iterating through directories and control which subdirectories are
583
+ included or excluded.
584
+ </p>
585
+ </li>
586
+ <li><tt>bytes</tt>
587
+
588
+ <pre>
589
+ rio('afile').bytes(1024)
590
+ </pre>
591
+ <p>
592
+ This causes a Rio to read the specified number of bytes at a time as a file
593
+ is iterated through.
594
+ </p>
595
+ </li>
596
+ </ul>
597
+ <h4>Grande selection methods</h4>
598
+ <ul>
599
+ <li><tt>lines</tt>, <tt>skiplines</tt>
600
+
601
+ <pre>
602
+ rio('afile').lines(0..9)
603
+ rio('afile').skiplines(/^\s*#/)
604
+ </pre>
605
+ <p>
606
+ Strictly speaking these are both configuration and selection methods. They
607
+ configure the Rio to iterate through an input stream as lines. The
608
+ arguments select which lines are actually returned. Lines are included
609
+ (<tt>lines</tt>) or excluded (<tt>skiplines</tt>) if they match <b>any</b>
610
+ of the arguments as follows.
611
+ </p>
612
+ <p>
613
+ If the argument is a:
614
+ </p>
615
+ <table>
616
+ <tr><td valign="top"><tt>RegExp</tt>:</td><td>the line is matched against it
617
+
618
+ </td></tr>
619
+ <tr><td valign="top"><tt>Range</tt>:</td><td>the lineno is matched against it
620
+
621
+ </td></tr>
622
+ <tr><td valign="top"><tt>Integer</tt>:</td><td>the lineno is matched against it as if it were a one element range
623
+
624
+ </td></tr>
625
+ <tr><td valign="top"><tt>Symbol</tt>:</td><td>the symbol is <tt>sent</tt> to the string; the line is included unless it
626
+ returns false
627
+
628
+ </td></tr>
629
+ <tr><td valign="top"><tt>Proc</tt>:</td><td>the proc is called with the line as an argument; the line is included
630
+ unless it returns false
631
+
632
+ </td></tr>
633
+ <tr><td valign="top"><tt>Array</tt>:</td><td>an array containing any of the above, all of which must match for the line
634
+ to be included
635
+
636
+ </td></tr>
637
+ </table>
638
+ </li>
639
+ <li><tt>entries</tt>, <tt>files</tt>, <tt>dirs</tt>, <tt>skipentries</tt>,
640
+ <tt>skipfiles</tt>, <tt>skipdirs</tt>
641
+
642
+ <pre>
643
+ rio('adir').files('*.txt')
644
+ rio('adir').skipfiles(/^\./)
645
+ </pre>
646
+ <p>
647
+ These methods select which entries will be returned when iterating throug
648
+ directories. Entries are included
649
+ (<tt>entries</tt>,<tt>files</tt>,<tt>dirs</tt>) or
650
+ excluded(<tt>skipentries</tt>,<tt>skipfiles</tt>,<tt>skipdirs</tt>) if they
651
+ match <b>any</b> of the arguments as follows.
652
+ </p>
653
+ <p>
654
+ If the argument is a:
655
+ </p>
656
+ <table>
657
+ <tr><td valign="top"><tt>String</tt>:</td><td>the arg is treated as a glob; the filname is matched against it
658
+
659
+ </td></tr>
660
+ <tr><td valign="top"><tt>RegExp</tt>:</td><td>the filname is matched against it
661
+
662
+ </td></tr>
663
+ <tr><td valign="top"><tt>Symbol</tt>:</td><td>the symbol is <tt>sent</tt> to the entry (a Rio); the entry is included
664
+ unless it returns false
665
+
666
+ </td></tr>
667
+ <tr><td valign="top"><tt>Proc</tt>:</td><td>the proc is called with the entry (a Rio) as an argument; the entry is
668
+ included unless it returns false
669
+
670
+ </td></tr>
671
+ <tr><td valign="top"><tt>Array</tt>:</td><td>an array containing any of the above, all of which must match for the line
672
+ to be included
673
+
674
+ </td></tr>
675
+ </table>
676
+ </li>
677
+ <li><tt>records</tt>, <tt>rows</tt>, <tt>skiprecords</tt>, <tt>skiprows</tt>
678
+
679
+ <pre>
680
+ rio('afile').bytes(1024).records(0...10)
681
+ </pre>
682
+ <p>
683
+ These select items from an input stream just as <tt>lines</tt>, but without
684
+ specifying lines as the input record type. They can be used to select
685
+ different record types in extension modules. The only such module at this
686
+ writing is the CSV extension. In that case <tt>records</tt> causes each
687
+ line of a CSV file to be parsed into an array while <tt>lines</tt> causes
688
+ each line of the file to be returned normally.
689
+ </p>
690
+ </li>
691
+ </ul>
692
+ <h3>Rio I/O</h3>
693
+ <p>
694
+ As stated above the the three steps to using a Rio are:
695
+ </p>
696
+ <ul>
697
+ <li>Creating a Rio
698
+
699
+ </li>
700
+ <li>Configuring a Rio
701
+
702
+ </li>
703
+ <li>Doing I/O
704
+
705
+ </li>
706
+ </ul>
707
+ <p>
708
+ This section describes that final step.
709
+ </p>
710
+ <p>
711
+ After creating and configuring a Rio, the file-system has not been
712
+ accessed, no socket has been opened, not so much as a test for a files
713
+ existance has been done. When an I/O method is called on a Rio, the
714
+ sequence of events required to complete that operation on the underlying
715
+ object takes place. Rio takes care of creating the appropriate object (eg
716
+ IO,Dir), opening the object with the appropriate mode, performing the
717
+ operation, closing the object if required, and returning the results of the
718
+ operation.
719
+ </p>
720
+ <p>
721
+ Rio&#8217;s I/O operations can be divide into two catagories:
722
+ </p>
723
+ <ul>
724
+ <li>Proxy operations
725
+
726
+ </li>
727
+ <li>Grande operations
728
+
729
+ </li>
730
+ </ul>
731
+ <h4>Proxy operations</h4>
732
+ <p>
733
+ These are calls which are forwarded to the underlying object (eg
734
+ IO,Dir,Net::FTP), after appropriately creating and configuring that object.
735
+ The result produced by the method is returned, and the object is closed.
736
+ </p>
737
+ <p>
738
+ In some cases the result is modified before being returned, as when a Rio
739
+ is configured with <a href="../IF/GrandeStream.html#M000082">chomp</a>.
740
+ </p>
741
+ <p>
742
+ In all cases, if the result returned by the underlying object, could itself
743
+ be used for further I/O operations it is returned as a Rio. For example:
744
+ where File#dirname returns a string, <a
745
+ href="../IF/Path.html#M000194">dirname</a> returns a Rio; where Dir#read
746
+ returns a string representing a directory entry, <a
747
+ href="../IF/FileOrDir.html#M000160">read</a> returns a Rio.
748
+ </p>
749
+ <p>
750
+ With some noteable exceptions, most of the operations available if one were
751
+ using the underlying Ruby I/O class are available to the Rio and will
752
+ behave identically.
753
+ </p>
754
+ <p>
755
+ For things that exist on a file system:
756
+ </p>
757
+ <ul>
758
+ <li>All the methods in FileTest are available as Rio instance methods. For
759
+ example
760
+
761
+ <pre>
762
+ FileTest.file?('afile')
763
+ </pre>
764
+ <p>
765
+ becomes
766
+ </p>
767
+ <pre>
768
+ rio('afile').file?
769
+ </pre>
770
+ </li>
771
+ <li>All the instance methods of <tt>File</tt> except <tt>path</tt> are
772
+ available to a rio without change
773
+
774
+ </li>
775
+ <li>Most of the class methods of <tt>File</tt> are available.
776
+
777
+ <ul>
778
+ <li>For those that take a filename as their only argument the calls are mapped
779
+ to Rio instance methods as described above for FileTest.
780
+
781
+ </li>
782
+ <li><tt>dirname</tt>, and <tt>readlink</tt> return Rios instead of strings
783
+
784
+ </li>
785
+ <li>Rio has its own <a href="../IF/Path.html#M000193">basename</a>, <a
786
+ href="../IF/Path.html#M000200">join</a> and <a
787
+ href="../IF/FileOrDir.html#M000156">symlink</a>, which provide similar
788
+ functionality.
789
+
790
+ </li>
791
+ <li>The class methods which take multiple filenames
792
+ (<tt>chmod</tt>,<tt>chown</tt>,<tt>lchmod</tt>,<tt>lchown</tt>) are
793
+ available as Rio instance methods. For example
794
+
795
+ <pre>
796
+ File.chmod(0666,'afile')
797
+ </pre>
798
+ <p>
799
+ becomes
800
+ </p>
801
+ <pre>
802
+ rio('afile').chmod(06660)
803
+ </pre>
804
+ </li>
805
+ </ul>
806
+ </li>
807
+ </ul>
808
+ <p>
809
+ For I/O Streams
810
+ </p>
811
+ <p>
812
+ Most of the instance methods of IO are available, and most do the same
813
+ thing, with some interface changes. <b>The big exception to this is the
814
+ &#8217;&lt;&lt;&#8217; operator.</b> This is one of Rio&#8217;s grande
815
+ operators. While the symantics one would use to write to an IO object would
816
+ actually accomplish the same thing with a Rio, It is a very different
817
+ operator. Read the section on grande operators. The other differences
818
+ between IO instance methods and the Rio equivelence can be summarized as
819
+ follows.
820
+ </p>
821
+ <ul>
822
+ <li>The simple instance methods (eg <tt>fcntl</tt>, <tt>eof?</tt>,
823
+ <tt>tty?</tt> etc.) are forwarded and the result returned as is
824
+
825
+ </li>
826
+ <li>Anywhere IO returns an IO, Rio returns a Rio
827
+
828
+ </li>
829
+ <li><tt>close</tt> and its cousins return the Rio.
830
+
831
+ </li>
832
+ <li><tt>each_byte</tt> and <tt>each_line</tt> are forwarded as is.
833
+
834
+ </li>
835
+ <li>All methods which read (read*,get*,each*) will cause the file to closed
836
+ when the end of file is reached. This behavior is configurable, but the
837
+ default is to close on eof
838
+
839
+ </li>
840
+ <li>The methods which write (put*,print*) are forwarded as is; put* and print*
841
+ return the Rio; write returns the value returned by IO#write; as mentioned
842
+ above &#8217;&lt;&lt;&#8217; is a grande operator in Rio.
843
+
844
+ </li>
845
+ </ul>
846
+ <p>
847
+ For directories:
848
+ </p>
849
+ <ul>
850
+ <li>all the instance methods of Dir are available except <tt>each</tt> which is
851
+ a grande method.
852
+
853
+ </li>
854
+ <li>the class methods <tt>mkdir</tt>, <tt>delete</tt>, <tt>rmdir</tt> are
855
+ provided as instance methods.
856
+
857
+ </li>
858
+ <li><tt>chdir</tt> is provided as an instance method. <a
859
+ href="../IF/Dir.html#M000045">chdir</a> returns a Rio and passes a Rio to a
860
+ block if one is provided.
861
+
862
+ </li>
863
+ <li><tt>glob</tt> is provided as an instance method, but returns an array of
864
+ Rios
865
+
866
+ </li>
867
+ <li><tt>foreach</tt> is not supported
868
+
869
+ </li>
870
+ <li><tt>each</tt> and <tt>[]</tt> have similar functionality provided by Rio
871
+
872
+ </li>
873
+ </ul>
874
+ <p>
875
+ For other Rios, instance methods are generally forwarded where appropriate.
876
+ For example
877
+ </p>
878
+ <ul>
879
+ <li>Rios that refer to StringIO objects forward &#8216;string&#8217; and
880
+ &#8216;string=&#8217;
881
+
882
+ </li>
883
+ <li>Rios that refer to http URIs support all the Meta methods provided by
884
+ open-uri
885
+
886
+ </li>
887
+ </ul>
888
+ <h4>Grande operators</h4>
889
+ <p>
890
+ The primary grande operator is <a
891
+ href="../IF/Grande.html#M000090">each</a>. <tt>each</tt> is used to iterate
892
+ through Rios. When applied to a file it iterates through records in the
893
+ file. When applied to a directory it iterates through the entries in the
894
+ directory. Its behavior is modified by configuring the Rio prior to calling
895
+ it using the configuration methods discussed above. Since iterating through
896
+ things is ubiquitous in ruby, it is implied by the presence of a block
897
+ after any of the grande configuration methods and many times does not need
898
+ to be call explicitly. For example:
899
+ </p>
900
+ <pre>
901
+ # iterate through chomped ruby comment lines
902
+ rio('afile.rb').chomp.lines(/^\s*#/) { |line| ... }
903
+
904
+ # iterate through all .rb files in 'adir' and its subdirectories
905
+ rio('adir').all.files('*.rb') { |f| ... }
906
+ </pre>
907
+ <p>
908
+ Because a Rio is an Enumerable, it supports <tt>to_a</tt>, which is the
909
+ basis for the grande subscript operator. <a
910
+ href="../IF/Grande.html#M000089">[]</a> with no arguments simply calls
911
+ to_a. With arguments it behaves as if those arguments had been passed to
912
+ the most recently called of the grande selection methods listed above, and
913
+ then calls to_a. For example to get the first ten lines of a file into an
914
+ array with lines chomped
915
+ </p>
916
+ <pre>
917
+ rio('afile').chomp.lines(0...10).to_a
918
+ </pre>
919
+ <p>
920
+ can be written as
921
+ </p>
922
+ <pre>
923
+ rio('afile.gz').chomp.lines[0...10]
924
+ </pre>
925
+ <p>
926
+ or, to create an array of all the .c files in a directory, one could write
927
+ </p>
928
+ <pre>
929
+ rio('adir').files['*.c']
930
+ </pre>
931
+ <p>
932
+ The other grande operators are its copy operators. They are:
933
+ </p>
934
+ <ul>
935
+ <li><tt>&lt;</tt> (copy-from)
936
+
937
+ </li>
938
+ <li><tt>&lt;&lt;</tt> (append-from)
939
+
940
+ </li>
941
+ <li><tt>&gt;</tt> (copy-to)
942
+
943
+ </li>
944
+ <li><tt>&gt;&gt;</tt> (append-to)
945
+
946
+ </li>
947
+ </ul>
948
+ <p>
949
+ The only difference between the &#8216;copy&#8217; and &#8216;append&#8217;
950
+ versions is how they deal with an unopened resource. In the former the open
951
+ it with mode &#8216;w&#8217; and in the latter, mode &#8216;a&#8217;.
952
+ Beyond that, their behavior can be summarized as:
953
+ </p>
954
+ <pre>
955
+ source.each do |entry|
956
+ destination &lt;&lt; entry
957
+ end
958
+ </pre>
959
+ <p>
960
+ Since they are based on the <tt>each</tt> operator, all of the selection
961
+ and configuration options are available. And the right-hand-side argument
962
+ of the operators are not restricted to Rios &#8212; Strings and Arrays are
963
+ also supported.
964
+ </p>
965
+ <p>
966
+ For example:
967
+ </p>
968
+ <pre>
969
+ rio('afile') &gt; astring # copy a file into a string
970
+
971
+ rio('afile').chomp &gt; anarray # copy the chomped lines of afile into an array
972
+
973
+ rio('afile.gz').gzip.lines(0...100) &gt; rio('bfile') # copy 100 lines from a gzipped file into another file
974
+
975
+ rio(?-) &lt; rio('http://rubydoc.org/') # copy a web page to stdout
976
+
977
+ rio('bdir') &lt; rio('adir') # copy an entire directory structure
978
+
979
+ rio('adir').dirs.files('README') &gt; rio('bdir') # same thing, but only README files
980
+
981
+ rio(?-,'ps -a').skiplines(0,/ps$/) &gt; anarray # copy the output of th ps command into an array, skippying
982
+ # the header line and the ps command entry
983
+ </pre>
984
+ <h3>Renaming and Moving</h3>
985
+ <p>
986
+ Rio provides two methods for directly renaming objects on the filesystem:
987
+ <a href="../IF/FileOrDir.html#M000158">rename</a> and <a
988
+ href="../IF/FileOrDir.html#M000159">rename!</a>. Both of these use
989
+ File#rename. The difference between them is the returned Rio. <a
990
+ href="../IF/FileOrDir.html#M000158">rename</a> leaves the path of the Rio
991
+ unchanged, while <a href="../IF/FileOrDir.html#M000159">rename!</a> changes
992
+ the path of the Rio to refer to the renamed path.
993
+ </p>
994
+ <pre>
995
+ ario = rio('a')
996
+ ario.rename('b') # file 'a' has been renamed to 'b' but 'ario' =&gt; rio('a')
997
+ ario.rename!('b') # file 'a' has been renamed to 'b' and 'ario' =&gt; rio('b')
998
+ </pre>
999
+ <p>
1000
+ Rio also has a <tt>rename</tt> mode, which causes the path manipulation
1001
+ methods <a href="../IF/Path.html#M000198">dirname=</a>, <a
1002
+ href="../IF/Path.html#M000199">filename=</a>, <a
1003
+ href="../IF/Path.html#M000197">basename=</a> and <a
1004
+ href="../IF/Path.html#M000196">extname=</a> to rename an object on the
1005
+ filesystem when they are used to change a Rio&#8217;s path. A Rio is put in
1006
+ <tt>rename</tt> mode by calling <a
1007
+ href="../IF/FileOrDir.html#M000158">rename</a> with no arguments.
1008
+ </p>
1009
+ <pre>
1010
+ rio('adir/afile.txt').rename.filename = 'bfile.rb' # adir/afile.txt =&gt; adir/bfile.rb
1011
+ rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt =&gt; adir/bfile.txt
1012
+ rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt =&gt; adir/afile.rb
1013
+ rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt =&gt; b/c/afile.txt
1014
+ </pre>
1015
+ <p>
1016
+ When <tt>rename</tt> mode is set for a directory Rio, it is automatically
1017
+ set in the Rios created when iterating through that directory.
1018
+ </p>
1019
+ <pre>
1020
+ rio('adir').rename.files('*.htm') do |frio|
1021
+ frio.extname = '.html' #=&gt; changes the rio and renames the file
1022
+ end
1023
+ </pre>
1024
+ <h3>Deleting</h3>
1025
+ <p>
1026
+ The Rio methods for deleting filesystem objects are <a
1027
+ href="../IF/File.html#M000212">rm</a>, <a
1028
+ href="../IF/Dir.html#M000048">rmdir</a>, <a
1029
+ href="../IF/Dir.html#M000049">rmtree</a>, <a
1030
+ href="../IF/Grande.html#M000091">delete</a>, and <a
1031
+ href="../IF/Grande.html#M000092">delete!</a>. <tt>rm</tt>, <tt>rmdir</tt>
1032
+ and <tt>rmtree</tt> are passed the like named methods in the FileUtils
1033
+ module. <a href="../IF/Grande.html#M000091">delete</a> calls <tt>rmdir</tt>
1034
+ for directories and <tt>rm</tt> for anything else, while <a
1035
+ href="../IF/Grande.html#M000092">delete!</a> calls <a
1036
+ href="../IF/Dir.html#M000049">rmtree</a> for directories.
1037
+ </p>
1038
+ <ul>
1039
+ <li>To delete something only if it is not a directory use <a
1040
+ href="../IF/File.html#M000212">rm</a>
1041
+
1042
+ </li>
1043
+ <li>To delete an empty directory use <a href="../IF/Dir.html#M000048">rmdir</a>
1044
+
1045
+ </li>
1046
+ <li>To delete an entire directory tree use <a
1047
+ href="../IF/Dir.html#M000049">rmtree</a>
1048
+
1049
+ </li>
1050
+ <li>To delete anything except a populated directory use <a
1051
+ href="../IF/Grande.html#M000091">delete</a>
1052
+
1053
+ </li>
1054
+ <li>To delete anything use <a href="../IF/Grande.html#M000092">delete!</a>
1055
+
1056
+ </li>
1057
+ </ul>
1058
+ <p>
1059
+ It is not an error to call any of the deleting methods on something that
1060
+ does not exist. Rio provides <a href="../IF/Test.html#M000123">exist?</a>
1061
+ and <a href="../IF/Test.html#M000126">symlink?</a> to check if something
1062
+ exists (<tt>exist?</tt> returns false for symlinks to non-existant object
1063
+ even though the symlink itself exists). The deleting methods&#8217; purpose
1064
+ is to make things not exist, so calling one of them on something that
1065
+ already does not exist is considered a success.
1066
+ </p>
1067
+ <p>
1068
+ To create a clean copy of a directory whether or not anything with that
1069
+ name exists one might do this
1070
+ </p>
1071
+ <pre>
1072
+ rio('adir').delete!.mkpath.chdir do
1073
+ # do something in adir
1074
+ end
1075
+ </pre>
1076
+ <hr size="1"></hr><h2>Miscellany</h2>
1077
+ <h4>Using Symbolic Links</h4>
1078
+ <p>
1079
+ To create a symbolic link (symlink) to the file-system entry refered to by
1080
+ a Rio, use <a href="../IF/FileOrDir.html#M000156">symlink</a>. <a
1081
+ href="../IF/FileOrDir.html#M000156">symlink</a> differs from File#symlink
1082
+ in that it calculates the path from the symlink location to the Rio&#8217;s
1083
+ position.
1084
+ </p>
1085
+ <pre>
1086
+ File#symlink('adir/afile','adir/alink')
1087
+ </pre>
1088
+ <p>
1089
+ creates a symlink in the directory &#8216;adir&#8217; named
1090
+ &#8216;alink&#8217; which references &#8216;adir/afile&#8217;. From the
1091
+ perspective of &#8216;alink&#8217;, &#8216;adir/afile&#8217; does not
1092
+ exist. While:
1093
+ </p>
1094
+ <pre>
1095
+ rio('adir/afile').symlink('adir/alink')
1096
+ </pre>
1097
+ <p>
1098
+ creates a symlink in the directory &#8216;adir&#8217; named
1099
+ &#8216;alink&#8217; which references &#8216;afile&#8217;. This is the route
1100
+ to &#8216;adir/afile&#8217; from the perspective of
1101
+ &#8216;adir/alink&#8217;.
1102
+ </p>
1103
+ <p>
1104
+ Note that the return value from <tt>symlink</tt> is the calling Rio and not
1105
+ a Rio refering to the symlink. This is done for consistency with the rest
1106
+ of Rio.
1107
+ </p>
1108
+ <p>
1109
+ <a href="../IF/Test.html#M000126">symlink?</a> can be used to test if a
1110
+ file-system object is a symlink. A Rio is extended with <a
1111
+ href="../IF/FileOrDir.html#M000157">readlink</a>, and <a
1112
+ href="../IF/Test.html#M000132">lstat</a> only if <a
1113
+ href="../IF/Test.html#M000126">symlink?</a> returns true. So for
1114
+ non-symlinks, these will raise a NoMethodError. These are both passed to
1115
+ their counterparts in File. <a
1116
+ href="../IF/FileOrDir.html#M000157">readlink</a> returns a Rio refering to
1117
+ the result of File#readlink.
1118
+ </p>
1119
+ <h4>Using A Rio as an IO (or File or Dir)</h4>
1120
+ <p>
1121
+ Rio supports so much of IO&#8217;s interface that one might be tempted to
1122
+ pass it to a method that expects an IO. While Rio is not and is not
1123
+ intended to be a stand in for IO, this can work. It requires knowledge of
1124
+ every IO method that will be called, under any circumstances.
1125
+ </p>
1126
+ <p>
1127
+ Even in cases where Rio supports the required IO interface, A Rio feature
1128
+ that seems to cause the most incompatibility, is its automatic closing of
1129
+ files. To turn off all of Rio&#8217;s automatic closing use <a
1130
+ href="../IF/GrandeStream.html#M000080">noautoclose</a>.
1131
+ </p>
1132
+ <p>
1133
+ For example:
1134
+ </p>
1135
+ <pre>
1136
+ require 'yaml'
1137
+ yrio = rio('ran.yaml').delete!.noautoclose
1138
+ YAML.dump( ['badger', 'elephant', 'tiger'], yrio )
1139
+ obj = YAML::load( yrio ) #=&gt; [&quot;badger&quot;, &quot;tiger&quot;, &quot;elephant&quot;]
1140
+ </pre>
1141
+ <h4>Automatically Closing Files</h4>
1142
+ <p>
1143
+ Rio closes files automatically in three instances.
1144
+ </p>
1145
+ <p>
1146
+ When reading from an IO it is closed when the end of file is reached. While
1147
+ this is a reasonable thing to do in many cases, sometimes this is not
1148
+ desired. To turn Rio&#8217;s automatic closing on end of file use <a
1149
+ href="../IF/GrandeStream.html#M000075">nocloseoneof</a> (it can be turned
1150
+ back on via <a href="../IF/GrandeStream.html#M000074">closeoneof</a>)
1151
+ </p>
1152
+ <pre>
1153
+ ario = rio('afile').nocloseoneof
1154
+ lines = ario[]
1155
+ ario.closed? #=&gt; false
1156
+ </pre>
1157
+ <p>
1158
+ Closing on end-of-file is necessary for many of Rio&#8217;s one-liners, but
1159
+ has an implication that may be surprising at first. A Rio starts life as a
1160
+ path, not much more than a string. When one of its read methods is called
1161
+ it becomes an input stream. When the stream is closed, it becomes a path
1162
+ again. This means that when reading from a Rio, the end-of-file condition
1163
+ is seen only once before it becomes a path again, and will be reopened if
1164
+ another read operation is attempted.
1165
+ </p>
1166
+ <p>
1167
+ Another time a Rio will be closed atomatically is when writing to it with
1168
+ one of the copy operators (<tt>&lt;, &lt;&lt;, &gt;, &gt;&gt;</tt>). This
1169
+ behavior can be turned off with <a
1170
+ href="../IF/GrandeStream.html#M000078">nocloseoncopy</a>.
1171
+ </p>
1172
+ <p>
1173
+ To turn off both of thes types of automatic closing use <a
1174
+ href="../IF/GrandeStream.html#M000080">noautoclose</a>.
1175
+ </p>
1176
+ <p>
1177
+ The third instance when Rio will close a file automatically is when a file
1178
+ opened for one type of access receives a method which that access mode does
1179
+ not support. So, the code
1180
+ </p>
1181
+ <pre>
1182
+ rio('afile').puts(&quot;Hello World&quot;).gets
1183
+ </pre>
1184
+ <p>
1185
+ will open the file for write access when the <tt>puts</tt> method is
1186
+ received. When <tt>gets</tt> is called the file is closed and reopened with
1187
+ read access.
1188
+ </p>
1189
+ <h4>Explicitly Closing Files</h4>
1190
+ <p>
1191
+ Rio can not determine when the client is finished writing to it, as it does
1192
+ using <tt>eof</tt> on read. It is the author&#8217;s understanding that
1193
+ Ruby does not support a mechanism to have code run when there are no more
1194
+ references to it &#8212; that finalizers are not necessarily run immediatly
1195
+ upon an object&#8217;s reference count reaching 0. If this understanding is
1196
+ incorrect, some of Rio&#8217;s extranious ways of closing a file may be
1197
+ rethought.
1198
+ </p>
1199
+ <p>
1200
+ That being said, Rio support several ways to explicitly close a file. <a
1201
+ href="../IF/RubyIO.html#M000030">close</a> will close any open Rio. The
1202
+ output methods <a href="../IF/RubyIO.html#M000022">puts!</a>, <a
1203
+ href="../IF/RubyIO.html#M000019">putc!</a>, <a
1204
+ href="../IF/RubyIO.html#M000017">printf!</a>, <a
1205
+ href="../IF/RubyIO.html#M000016">print!</a>, and <a
1206
+ href="../IF/RubyIO.html#M000023">write!</a> behave as if their counterparts
1207
+ without the exclamation point had been called and then call <a
1208
+ href="../IF/RubyIO.html#M000030">close</a> or <a
1209
+ href="../IF/RubyIO.html#M000031">close_write</a> if the underlying IO
1210
+ object is opened for duplex access.
1211
+ </p>
1212
+ <h4>Open mode selection</h4>
1213
+ <p>
1214
+ A Rio is typically not explicitly opened. It opens a file automatically
1215
+ when an input or output methed is called. For output methods Rio opens a
1216
+ file with mode &#8216;w&#8217;, and otherwise opens a file with mode
1217
+ &#8216;r&#8217;. This behavior can be modified using the tersely named
1218
+ methods <a href="../IF/GrandeStream.html#M000067">a</a>, <a
1219
+ href="../IF/GrandeStream.html#M000069">a!</a>, <a
1220
+ href="../IF/GrandeStream.html#M000070">r</a>, <a
1221
+ href="../IF/GrandeStream.html#M000071">r!</a>, <a
1222
+ href="../IF/GrandeStream.html#M000072">w</a>, and <a
1223
+ href="../IF/GrandeStream.html#M000073">w!</a>, which cause the Rio to use
1224
+ modes
1225
+ &#8216;a&#8217;,&#8217;a+&#8217;,&#8217;r&#8217;,&#8217;r+&#8217;,&#8217;w&#8217;,and
1226
+ &#8216;w+&#8217; respectively.
1227
+ </p>
1228
+ <p>
1229
+ One way to append a string to a file and close it in one line is
1230
+ </p>
1231
+ <pre>
1232
+ rio('afile').a.puts!(&quot;Hello World&quot;)
1233
+ </pre>
1234
+ <p>
1235
+ Run a cmd that must be opened for read and write
1236
+ </p>
1237
+ <pre>
1238
+ ans = rio(?-,'cat').w!.puts!(&quot;Hello Kitty&quot;).readline
1239
+ </pre>
1240
+ <p>
1241
+ The automatic selection of mode can be bypassed entirely using <a
1242
+ href="../IF/RubyIO.html#M000028">mode</a> and <a
1243
+ href="../IF/FileOrDir.html#M000155">open</a>.
1244
+ </p>
1245
+ <p>
1246
+ If a mode is specified using <tt>mode</tt>, the file will still be opened
1247
+ automatically, but the mode specified in the <tt>mode</tt> method will be
1248
+ used regardless of whether it makes sense.
1249
+ </p>
1250
+ <p>
1251
+ A Rio can also be opened explicitly using <a
1252
+ href="../IF/FileOrDir.html#M000155">open</a>. <tt>open</tt> takes one
1253
+ parameter, a mode. This also will override all of Rio&#8217;s automatic
1254
+ mode selection.
1255
+ </p>
1256
+ <h4>CSV mode</h4>
1257
+ <p>
1258
+ Rio uses the CSV class from the Ruby standard library to provide support
1259
+ for reading and writing comma-separated-value files. Normally using
1260
+ <tt>(skip)records</tt> is identical to <tt>(skip)lines</tt> because while
1261
+ <tt>records</tt> only selects and does not specify the record-type,
1262
+ <tt>lines</tt> is the default.
1263
+ </p>
1264
+ <pre>
1265
+ rio('afile').records(1..2)
1266
+ </pre>
1267
+ <p>
1268
+ effectively means
1269
+ </p>
1270
+ <pre>
1271
+ rio('afile').lines.records(1..2)
1272
+ </pre>
1273
+ <p>
1274
+ The CSV extension distingishes between items selected using <a
1275
+ href="../IF/GrandeStream.html#M000057">records</a> and those selected using
1276
+ <a href="../IF/GrandeStream.html#M000055">lines</a>. Rio returns records
1277
+ parsed into Arrays by the CSV library when <tt>records</tt> is used, and
1278
+ returns Strings as normal when <tt>lines</tt> is used. <tt>records</tt> is
1279
+ the default.
1280
+ </p>
1281
+ <pre>
1282
+ rio('f.csv').puts!([&quot;h0,h1&quot;,&quot;f0,f1&quot;])
1283
+
1284
+ rio('f.csv').csv.records[] #==&gt;[[&quot;h0&quot;, &quot;h1&quot;], [&quot;f0&quot;, &quot;f1&quot;]]
1285
+ rio('f.csv').csv[] #==&gt; same thing
1286
+ rio('f.csv').csv.lines[] #==&gt;[&quot;h0,h1\n&quot;, &quot;f0,f1\n&quot;]
1287
+ rio('f.csv').csv.records[0] #==&gt;[[&quot;h0&quot;, &quot;h1&quot;]]
1288
+ rio('f.csv').csv[0] #==&gt; same thing
1289
+ rio('f.csv').csv.lines[0] #==&gt;[&quot;h0,h1\n&quot;]
1290
+ rio('f.csv').csv.skiprecords[0] #==&gt;[[&quot;f0&quot;, &quot;f1&quot;]]
1291
+ rio('f.csv').csv.skiplines[0] #==&gt;[&quot;f0,f1\n&quot;]
1292
+ </pre>
1293
+ <p>
1294
+ This distinction, of course, applies equally when using the copy operators
1295
+ and <tt>each</tt>
1296
+ </p>
1297
+ <pre>
1298
+ rio('f.csv').csv[0] &gt; rio('out').csv # out contains &quot;f0,f1\n&quot;
1299
+
1300
+ rio('f.csv').csv { |array_of_fields| ... }
1301
+ </pre>
1302
+ <p>
1303
+ Notice that <tt>csv</tt> mode is called on both the input and output Rios.
1304
+ The <tt>csv</tt> on the &#8216;out&#8217; Rio causes it to treat an array
1305
+ written to it as an array of records which is converted into CSV format
1306
+ before writing. Without the <tt>csv</tt>, the output would be written as if
1307
+ Array#to_s on [[&quot;f0&quot;,&quot;f1&quot;]] had been called
1308
+ </p>
1309
+ <pre>
1310
+ rio('f.csv').csv[0] &gt; rio('out') # out contains &quot;f0f1&quot;
1311
+ </pre>
1312
+ <p>
1313
+ The String representing a record that is returned when using <tt>lines</tt>
1314
+ is extended with a <tt>to_a</tt> method which will parse it into an array
1315
+ of fields. Likewise the Array returned when a record is returned using
1316
+ <tt>records</tt> is extended with a modified <tt>to_s</tt> which treats it
1317
+ as an array CSV fields, rather than just an array of strings.
1318
+ </p>
1319
+ <pre>
1320
+ array_of_lines = rio('f.csv').csv.lines[1] #==&gt;[&quot;f0,f1\n&quot;]
1321
+ array_of_records = rio('f.csv').csv.records[1] #==&gt;[[&quot;f0&quot;, &quot;f1&quot;]]
1322
+
1323
+ array_of_lines[0].to_a #==&gt;[&quot;f0&quot;, &quot;f1&quot;]
1324
+ array_of_records[0].to_s #==&gt;&quot;f0,f1&quot;
1325
+ </pre>
1326
+ <p>
1327
+ <a href="../IF/CSV.html#M000116">csv</a> takes two optional parameters,
1328
+ which are passed on to the CSV library. They are the
1329
+ <tt>field_separator</tt> and the <tt>record_separator</tt>.
1330
+ </p>
1331
+ <pre>
1332
+ rio('semisep').puts!([&quot;h0;h1&quot;,&quot;f0;f1&quot;])
1333
+
1334
+ rio('semisep').csv(';').to_a #==&gt;[[&quot;h0&quot;, &quot;h1&quot;], [&quot;f0&quot;, &quot;f1&quot;]]
1335
+ </pre>
1336
+ <p>
1337
+ These are specified independently on the source and destination when using
1338
+ the copy operators.
1339
+ </p>
1340
+ <pre>
1341
+ rio('semisep').csv(';') &gt; rio('colonsep').csv(':')
1342
+ rio('colonsep').contents #==&gt;&quot;h0:h1\nf0:f1\n&quot;
1343
+ </pre>
1344
+ <p>
1345
+ Rio provides two methods for selecting fields from CSV records in a manner
1346
+ similar to that provided for selecting lines &#8212; <a
1347
+ href="../IF/CSV.html#M000117">columns</a> and <a
1348
+ href="../IF/CSV.html#M000118">skipcolumns</a>.
1349
+ </p>
1350
+ <pre>
1351
+ rio('f.csv').puts!([&quot;h0,h1,h2,h3&quot;,&quot;f0,f1,f2,f3&quot;])
1352
+
1353
+ rio('f.csv').csv.columns(0).to_a #==&gt;[[&quot;h0&quot;], [&quot;f0&quot;]]
1354
+ rio('f.csv').csv.skipcolumns(0).to_a #==&gt;[[&quot;h1&quot;, &quot;h2&quot;, &quot;h3&quot;], [&quot;f1&quot;, &quot;f2&quot;, &quot;f3&quot;]]
1355
+ rio('f.csv').csv.columns(1..2).to_a #==&gt;[[&quot;h1&quot;, &quot;h2&quot;], [&quot;f1&quot;, &quot;f2&quot;]]
1356
+ rio('f.csv').csv.skipcolumns(1..2).to_a #==&gt;[[&quot;h0&quot;, &quot;h3&quot;], [&quot;f0&quot;, &quot;f3&quot;]]
1357
+ </pre>
1358
+ <p>
1359
+ <a href="../IF/CSV.html#M000117">columns</a> can, of course be used with
1360
+ the <tt>each</tt> and the copy operators:
1361
+ </p>
1362
+ <pre>
1363
+ rio('f.csv').csv.columns(0..1) &gt; rio('out').csv
1364
+ rio('out').contents #==&gt;&quot;h0,h1\nf0,f1\n&quot;
1365
+ </pre>
1366
+ <h4>YAML mode</h4>
1367
+ <p>
1368
+ Rio uses the YAML class from the Ruby standard library to provide support
1369
+ for reading and writing YAML files. Normally using <tt>(skip)records</tt>
1370
+ is identical to <tt>(skip)lines</tt> because while <tt>records</tt> only
1371
+ selects and does not specify the record-type, <tt>lines</tt> is the
1372
+ default.
1373
+ </p>
1374
+ <p>
1375
+ The YAML extension distingishes between items selected using <a
1376
+ href="../IF/GrandeStream.html#M000057">records</a>, <a
1377
+ href="../IF/GrandeStream.html#M000060">rows</a> and <a
1378
+ href="../IF/GrandeStream.html#M000055">lines</a>. Rio returns objects
1379
+ loaded via YAML#load when <tt>records</tt> is used; returns the YAML text
1380
+ as a String when <tt>rows</tt> is used; and returns lines as Strings as
1381
+ normal when <tt>lines</tt> is used. <tt>records</tt> is the default. In
1382
+ yaml-mode, <tt>(skip)records</tt> can be called as <tt>(skip)objects</tt>
1383
+ and <tt>(skip)rows</tt> can be called as <tt>(skip)documents</tt>
1384
+ </p>
1385
+ <p>
1386
+ To read a single YAML document, Rio provides #getobj and #load For example,
1387
+ consider the following partial &#8216;database.yml&#8217; from the rails
1388
+ distribution:
1389
+ </p>
1390
+ <pre>
1391
+ development:
1392
+ adapter: mysql
1393
+ database: rails_development
1394
+
1395
+ test:
1396
+ adapter: mysql
1397
+ database: rails_test
1398
+ </pre>
1399
+ <p>
1400
+ To get the object represented in the yaml file:
1401
+ </p>
1402
+ <pre>
1403
+ rio('database.yml').yaml.load
1404
+ ==&gt;{&quot;development&quot;=&gt;{&quot;adapter&quot;=&gt;&quot;mysql&quot;, &quot;database&quot;=&gt;&quot;rails_development&quot;},
1405
+ &quot;test&quot;=&gt;{&quot;adapter&quot;=&gt;&quot;mysql&quot;, &quot;database&quot;=&gt;&quot;rails_test&quot;}}
1406
+ </pre>
1407
+ <p>
1408
+ Or one could read parts of the file like so:
1409
+ </p>
1410
+ <pre>
1411
+ rio('database.yml').yaml.getobj['development']['database']
1412
+ ==&gt;&quot;rails_development&quot;
1413
+ </pre>
1414
+ <p>
1415
+ Single objects can be written using #putobj and #putobj! which is aliased
1416
+ to #dump
1417
+ </p>
1418
+ <pre>
1419
+ anobject = {
1420
+ 'production' =&gt; {
1421
+ 'adapter' =&gt; 'mysql',
1422
+ 'database' =&gt; 'rails_production',
1423
+ }
1424
+ }
1425
+ rio('afile.yaml').yaml.dump(anobject)
1426
+ </pre>
1427
+ <p>
1428
+ <a href="../IF/Grande.html#M000093">></a> (copy-to) and <a
1429
+ href="../IF/Grande.html#M000096">>></a> (append-to) will fill an array with
1430
+ with all selected YAML documents in the Rio. For non-arrays, the yaml text
1431
+ is copied. (This may change if a useful reasonable alternative can be
1432
+ found)
1433
+ </p>
1434
+ <pre>
1435
+ rio('afile.yaml').yaml &gt; anarray # load all YAML documents from 'afile.yaml'
1436
+ </pre>
1437
+ <p>
1438
+ Single objects can be written using <a
1439
+ href="../IF/GrandeStream.html#M000066">putrec</a> (aliased to <a
1440
+ href="../IF/YAML.html#M000177">putobj</a> and <a
1441
+ href="../IF/YAML.html#M000179">dump</a>)
1442
+ </p>
1443
+ <pre>
1444
+ rio('afile.yaml').yaml.putobj(anobject)
1445
+ </pre>
1446
+ <p>
1447
+ Single objects can be loaded using <a
1448
+ href="../IF/GrandeStream.html#M000062">getrec</a> (aliase to <a
1449
+ href="../IF/YAML.html#M000175">getobj</a> and <a
1450
+ href="../IF/YAML.html#M000176">load</a>)
1451
+ </p>
1452
+ <pre>
1453
+ anobject = rio('afile.yaml').yaml.getobj
1454
+ </pre>
1455
+ <p>
1456
+ A Rio in yaml-mode is just like any other Rio. And all the things you can
1457
+ do with any Rio come for free. They can be iterated over using <a
1458
+ href="../IF/Grande.html#M000090">each</a> and read into an array using <a
1459
+ href="../IF/Grande.html#M000089">[]</a> just like any other Rio. All the
1460
+ selection criteria are identical also.
1461
+ </p>
1462
+ <p>
1463
+ Get the first three objects into an array:
1464
+ </p>
1465
+ <pre>
1466
+ array_of_objects = rio('afile.yaml').yaml[0..2]
1467
+ </pre>
1468
+ <p>
1469
+ Iterate over only YAML documents that are a kind_of ::Hash use:
1470
+ </p>
1471
+ <pre>
1472
+ rio('afile.yaml').yaml(::Hash) {|ahash| ...}
1473
+ </pre>
1474
+ <p>
1475
+ This takes advantage of the fact that the default for matching records is
1476
+ <tt>===</tt>
1477
+ </p>
1478
+ <p>
1479
+ Selecting records using a Proc can be used as normal:
1480
+ </p>
1481
+ <pre>
1482
+ anarray = rio('afile.yaml').yaml(proc{|anobject| ...}).to_a
1483
+ </pre>
1484
+ <hr size="1"></hr><p>
1485
+ See also:
1486
+ </p>
1487
+ <ul>
1488
+ <li><a href="SYNOPSIS.html">RIO::Doc::SYNOPSIS</a>
1489
+
1490
+ </li>
1491
+ <li><a href="HOWTO.html">RIO::Doc::HOWTO</a>
1492
+
1493
+ </li>
1494
+ <li><a href="EXAMPLES.html">RIO::Doc::EXAMPLES</a>
1495
+
1496
+ </li>
1497
+ <li><a href="../Rio.html">RIO::Rio</a>
1498
+
1499
+ </li>
1500
+ </ul>
1501
+
1502
+ </div>
1503
+
1504
+
1505
+ </div>
1506
+
1507
+
1508
+
1509
+
1510
+ <!-- if includes -->
1511
+
1512
+ <div id="section">
1513
+
1514
+
1515
+
1516
+
1517
+
1518
+
1519
+
1520
+
1521
+ <!-- if method_list -->
1522
+ </div>
1523
+
1524
+
1525
+ </div>
1526
+
1527
+
1528
+ <div id="validator-badges">
1529
+ <p><small>Copyright &copy; 2005,2006,2007 Christopher Kleckner. <a href="http://www.gnu.org/licenses/gpl.html">All rights reserved</a>.</small></p>
1530
+ </div>
1531
+
1532
+ </body>
1533
+ </html>