rio 0.4.2 → 0.5.1

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