rio 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +0 -0
- data/ChangeLog +3122 -0
- data/README +2 -2
- data/Rakefile +1 -1
- data/VERSION +1 -0
- data/build_doc.rb +28 -3
- data/doc/ANNOUNCE +1 -1
- data/doc/RELEASE_NOTES +0 -0
- data/doc/RIOIS +1 -1
- data/doc/generators/template/html/rio.css +1 -1
- data/doc/generators/template/html/rio.rb +2 -2
- data/doc/generators/template/html/ugly.rb +1 -1
- data/doc/pkg_def.rb +1 -1
- data/doc/rdoc/classes/Kernel.html +133 -0
- data/doc/rdoc/classes/Kernel.src/M000234.html +18 -0
- data/doc/rdoc/classes/RIO.html +625 -0
- data/doc/rdoc/classes/RIO.src/M000001.html +18 -0
- data/doc/rdoc/classes/RIO.src/M000002.html +18 -0
- data/doc/rdoc/classes/RIO.src/M000003.html +18 -0
- data/doc/rdoc/classes/RIO/Doc.html +149 -0
- data/doc/rdoc/classes/RIO/Doc/EXAMPLES.html +432 -0
- data/doc/rdoc/classes/RIO/Doc/HOWTO.html +1084 -0
- data/doc/rdoc/classes/RIO/Doc/INDEX.html +368 -0
- data/doc/rdoc/classes/RIO/Doc/INTRO.html +1529 -0
- data/doc/rdoc/classes/RIO/Doc/OPTIONAL.html +221 -0
- data/doc/rdoc/classes/RIO/Doc/SYNOPSIS.html +336 -0
- data/doc/rdoc/classes/RIO/IF.html +165 -0
- data/doc/rdoc/classes/RIO/IF/CSV.html +203 -0
- data/doc/rdoc/classes/RIO/IF/CSV.src/M000129.html +19 -0
- data/doc/rdoc/classes/RIO/IF/CSV.src/M000130.html +16 -0
- data/doc/rdoc/classes/RIO/IF/CSV.src/M000131.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Dir.html +343 -0
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000045.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000046.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000047.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000048.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000049.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000050.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000051.html +16 -0
- data/doc/rdoc/classes/RIO/IF/File.html +223 -0
- data/doc/rdoc/classes/RIO/IF/File.src/M000216.html +16 -0
- data/doc/rdoc/classes/RIO/IF/File.src/M000217.html +16 -0
- data/doc/rdoc/classes/RIO/IF/File.src/M000218.html +16 -0
- data/doc/rdoc/classes/RIO/IF/File.src/M000219.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.html +572 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000117.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000118.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000119.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000120.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000121.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000122.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000123.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000124.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000125.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000126.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000127.html +16 -0
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000128.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.html +1376 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000052.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000053.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000054.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000055.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000056.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000057.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000058.html +21 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000059.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000060.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000061.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000062.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000063.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000064.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000065.html +21 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000066.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000067.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000068.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000069.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000070.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.html +810 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000107.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000108.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000109.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000110.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000111.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000112.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000113.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000114.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000115.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000116.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.html +1513 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000071.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000072.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000073.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000074.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000075.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000076.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000077.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000078.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000079.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000080.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000081.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000082.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000083.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000084.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000085.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000086.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000087.html +19 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000088.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000089.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000090.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000091.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000092.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000093.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000094.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000095.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000096.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000097.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000098.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000099.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000100.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000101.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000102.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000103.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000104.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000105.html +16 -0
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000106.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.html +999 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000132.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000133.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000134.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000135.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000136.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000137.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000138.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000139.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000140.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000141.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000142.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000143.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000144.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000145.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000146.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000147.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000148.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000149.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000150.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000151.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000152.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000153.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000154.html +18 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000155.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000156.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000157.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000158.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000159.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000160.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000161.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000162.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Path.src/M000163.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.html +1416 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000004.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000005.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000006.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000007.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000008.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000009.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000010.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000011.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000012.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000013.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000014.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000015.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000016.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000017.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000018.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000019.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000020.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000021.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000022.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000023.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000024.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000025.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000026.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000027.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000028.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000029.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000030.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000031.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000032.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000033.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000034.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000035.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000036.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000037.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000038.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000039.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000040.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000041.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000042.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000043.html +16 -0
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000044.html +16 -0
- data/doc/rdoc/classes/RIO/IF/String.html +203 -0
- data/doc/rdoc/classes/RIO/IF/String.src/M000213.html +16 -0
- data/doc/rdoc/classes/RIO/IF/String.src/M000214.html +16 -0
- data/doc/rdoc/classes/RIO/IF/String.src/M000215.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.html +990 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000177.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000178.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000179.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000180.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000181.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000182.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000183.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000184.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000185.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000186.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000187.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000188.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000189.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000190.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000191.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000192.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000193.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000194.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000195.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000196.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000197.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000198.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000199.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000200.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000201.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000202.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000203.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000204.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000205.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000206.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000207.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000208.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000209.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000210.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000211.html +16 -0
- data/doc/rdoc/classes/RIO/IF/Test.src/M000212.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.html +517 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000164.html +19 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000165.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000166.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000167.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000168.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000169.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000170.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000171.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000172.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000173.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000174.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000175.html +16 -0
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000176.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.html +508 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000220.html +18 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000221.html +20 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000222.html +27 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000223.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000225.html +19 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000226.html +20 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000227.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000228.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000229.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000230.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000231.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000232.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000233.html +16 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/README.html +232 -0
- data/doc/rdoc/files/lib/rio/constructor_rb.html +141 -0
- data/doc/rdoc/files/lib/rio/doc/EXAMPLES_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/doc/HOWTO_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/doc/INDEX_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/doc/INTRO_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/doc/OPTIONAL_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/doc/SYNOPSIS_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/basic_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/csv_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/dir_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/file_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/fileordir_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/grande_entry_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/grande_rb.html +141 -0
- data/doc/rdoc/files/lib/rio/if/grande_stream_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/internal_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/path_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/rubyio_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/string_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/temp_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/test_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/if/yaml_rb.html +134 -0
- data/doc/rdoc/files/lib/rio/kernel_rb.html +142 -0
- data/doc/rdoc/files/lib/rio_rb.html +153 -0
- data/doc/rdoc/fr_class_index.html +49 -0
- data/doc/rdoc/fr_file_index.html +51 -0
- data/doc/rdoc/fr_method_index.html +260 -0
- data/doc/rdoc/index.html +30 -0
- data/doc/rdoc/rdoc-style.css +428 -0
- data/doc/rfc1738.txt +0 -0
- data/doc/rfc959.txt +0 -0
- data/ex/catcsv.rb +0 -0
- data/ex/colx.rb +0 -0
- data/ex/findinruby +0 -0
- data/ex/findruby +0 -0
- data/ex/passwd_report.rb +0 -0
- data/ex/prompt.rb +0 -0
- data/ex/rgb.txt.gz +0 -0
- data/ex/riocat +0 -0
- data/ex/riogunzip +0 -0
- data/ex/riogzip +0 -0
- data/ex/rioprompt.rb +0 -0
- data/ex/targz2zip +0 -0
- data/ex/tonl +0 -0
- data/lib/rio.rb +1 -1
- data/lib/rio/abstract_method.rb +1 -1
- data/lib/rio/argv.rb +1 -1
- data/lib/rio/arycopy.rb +1 -1
- data/lib/rio/assert.rb +1 -1
- data/lib/rio/base.rb +1 -1
- data/lib/rio/callstr.rb +1 -1
- data/lib/rio/const.rb +1 -1
- data/lib/rio/construct.rb +1 -1
- data/lib/rio/constructor.rb +1 -1
- data/lib/rio/context.rb +1 -1
- data/lib/rio/context/autoclose.rb +1 -1
- data/lib/rio/context/copying.rb +1 -1
- data/lib/rio/context/cxx.rb +1 -1
- data/lib/rio/context/dir.rb +1 -1
- data/lib/rio/context/gzip.rb +1 -1
- data/lib/rio/context/methods.rb +1 -1
- data/lib/rio/context/skip.rb +1 -1
- data/lib/rio/context/stream.rb +1 -1
- data/lib/rio/cp.rb +1 -1
- data/lib/rio/def.rb +1 -1
- data/lib/rio/dir.rb +1 -1
- data/lib/rio/doc.rb +5 -4
- data/lib/rio/doc/EXAMPLES.rb +1 -1
- data/lib/rio/doc/HOWTO.rb +8 -2
- data/lib/rio/doc/INDEX.rb +1 -1
- data/lib/rio/doc/INTRO.rb +2 -2
- data/lib/rio/doc/OPTIONAL.rb +1 -1
- data/lib/rio/doc/SYNOPSIS.rb +2 -2
- data/lib/rio/entrysel.rb +1 -1
- data/lib/rio/exception.rb +1 -1
- data/lib/rio/exception/copy.rb +1 -1
- data/lib/rio/exception/notimplemented.rb +1 -1
- data/lib/rio/exception/notsupported.rb +1 -1
- data/lib/rio/exception/open.rb +1 -1
- data/lib/rio/exception/state.rb +1 -1
- data/lib/rio/ext.rb +1 -1
- data/lib/rio/ext/csv.rb +1 -1
- data/lib/rio/ext/if.rb +1 -1
- data/lib/rio/ext/mp3info.rb +1 -1
- data/lib/rio/ext/splitlines.rb +1 -1
- data/lib/rio/ext/yaml.rb +1 -1
- data/lib/rio/ext/yaml/doc.rb +1 -1
- data/lib/rio/ext/yaml/tie.rb +1 -1
- data/lib/rio/ext/zipfile.rb +1 -1
- data/lib/rio/ext/zipfile/fs.rb +1 -1
- data/lib/rio/ext/zipfile/rl.rb +1 -1
- data/lib/rio/ext/zipfile/rootdir.rb +1 -1
- data/lib/rio/ext/zipfile/state.rb +1 -1
- data/lib/rio/ext/zipfile/wrap.rb +1 -1
- data/lib/rio/factory.rb +1 -1
- data/lib/rio/file.rb +1 -1
- data/lib/rio/filter.rb +1 -1
- data/lib/rio/filter/closeoneof.rb +1 -1
- data/lib/rio/filter/gzip.rb +1 -1
- data/lib/rio/fs/base.rb +1 -1
- data/lib/rio/fs/impl.rb +1 -1
- data/lib/rio/fs/native.rb +1 -1
- data/lib/rio/fs/stream.rb +1 -1
- data/lib/rio/fs/url.rb +1 -1
- data/lib/rio/ftp/conncache.rb +1 -1
- data/lib/rio/ftp/dir.rb +1 -1
- data/lib/rio/ftp/fs.rb +1 -1
- data/lib/rio/ftp/ftpfile.rb +0 -0
- data/lib/rio/grande.rb +1 -1
- data/lib/rio/handle.rb +1 -1
- data/lib/rio/if.rb +1 -1
- data/lib/rio/if/basic.rb +1 -1
- data/lib/rio/if/csv.rb +1 -1
- data/lib/rio/if/dir.rb +1 -1
- data/lib/rio/if/file.rb +1 -1
- data/lib/rio/if/fileordir.rb +1 -1
- data/lib/rio/if/grande.rb +20 -11
- data/lib/rio/if/grande_entry.rb +2 -2
- data/lib/rio/if/grande_stream.rb +1 -1
- data/lib/rio/if/internal.rb +1 -1
- data/lib/rio/if/path.rb +1 -1
- data/lib/rio/if/rubyio.rb +3 -3
- data/lib/rio/if/string.rb +1 -1
- data/lib/rio/if/temp.rb +1 -1
- data/lib/rio/if/test.rb +1 -1
- data/lib/rio/if/yaml.rb +1 -1
- data/lib/rio/ioh.rb +1 -1
- data/lib/rio/iomode.rb +1 -1
- data/lib/rio/ios/fail.rb +1 -1
- data/lib/rio/ios/generic.rb +1 -1
- data/lib/rio/ios/mode.rb +1 -1
- data/lib/rio/ios/null.rb +1 -1
- data/lib/rio/iowrap.rb +1 -1
- data/lib/rio/kernel.rb +1 -1
- data/lib/rio/local.rb +1 -1
- data/lib/rio/match.rb +1 -1
- data/lib/rio/matchrecord.rb +1 -1
- data/lib/rio/no_warn.rb +1 -1
- data/lib/rio/nullio.rb +1 -1
- data/lib/rio/open3.rb +2 -2
- data/lib/rio/ops/construct.rb +1 -1
- data/lib/rio/ops/create.rb +1 -1
- data/lib/rio/ops/dir.rb +4 -3
- data/lib/rio/ops/either.rb +1 -1
- data/lib/rio/ops/file.rb +3 -1
- data/lib/rio/ops/path.rb +1 -1
- data/lib/rio/ops/stream.rb +1 -1
- data/lib/rio/ops/stream/input.rb +1 -1
- data/lib/rio/ops/stream/output.rb +1 -1
- data/lib/rio/ops/stream/read.rb +1 -1
- data/lib/rio/ops/stream/write.rb +1 -1
- data/lib/rio/ops/symlink.rb +10 -1
- data/lib/rio/path.rb +1 -1
- data/lib/rio/path/reset.rb +1 -1
- data/lib/rio/piper.rb +1 -1
- data/lib/rio/piper/cp.rb +1 -1
- data/lib/rio/prompt.rb +6 -2
- data/lib/rio/rectype.rb +1 -1
- data/lib/rio/rl/base.rb +1 -1
- data/lib/rio/rl/builder.rb +1 -1
- data/lib/rio/rl/chmap.rb +1 -1
- data/lib/rio/rl/fs2url.rb +1 -1
- data/lib/rio/rl/ioi.rb +1 -1
- data/lib/rio/rl/path.rb +1 -1
- data/lib/rio/rl/pathmethods.rb +1 -1
- data/lib/rio/rl/uri.rb +1 -1
- data/lib/rio/rl/withpath.rb +1 -1
- data/lib/rio/scheme/aryio.rb +1 -1
- data/lib/rio/scheme/cmdio.rb +1 -1
- data/lib/rio/scheme/cmdpipe.rb +1 -1
- data/lib/rio/scheme/fd.rb +1 -1
- data/lib/rio/scheme/ftp.rb +1 -1
- data/lib/rio/scheme/http.rb +1 -1
- data/lib/rio/scheme/null.rb +1 -1
- data/lib/rio/scheme/path.rb +5 -5
- data/lib/rio/scheme/stderr.rb +1 -1
- data/lib/rio/scheme/stdio.rb +1 -1
- data/lib/rio/scheme/strio.rb +1 -1
- data/lib/rio/scheme/sysio.rb +1 -1
- data/lib/rio/scheme/tcp.rb +1 -1
- data/lib/rio/scheme/temp.rb +1 -1
- data/lib/rio/state.rb +2 -9
- data/lib/rio/state/error.rb +1 -1
- data/lib/rio/stream.rb +1 -1
- data/lib/rio/stream/base.rb +1 -1
- data/lib/rio/stream/duplex.rb +1 -1
- data/lib/rio/stream/open.rb +1 -1
- data/lib/rio/symantics.rb +1 -1
- data/lib/rio/tempdir.rb +0 -0
- data/lib/rio/to_rio.rb +1 -1
- data/lib/rio/to_rio/all.rb +1 -1
- data/lib/rio/to_rio/array.rb +1 -1
- data/lib/rio/to_rio/io.rb +1 -1
- data/lib/rio/to_rio/object.rb +1 -1
- data/lib/rio/to_rio/string.rb +1 -1
- data/lib/rio/uri/file.rb +1 -1
- data/lib/rio/util.rb +1 -1
- data/lib/rio/version.rb +2 -2
- data/test/bin/count_lines.rb +0 -0
- data/test/bin/find_lines.rb +0 -0
- data/test/bin/list_dir.rb +0 -0
- data/test/ftp/all.rb +0 -0
- data/test/ftp/anon_misc.rb +0 -0
- data/test/ftp/anon_read.rb +0 -0
- data/test/ftp/anon_special.rb +0 -0
- data/test/ftp/anon_write.rb +0 -0
- data/test/ftp/ftp2ftp.rb +0 -0
- data/test/ftp/initftpfiles.rb +0 -0
- data/test/ftp/testdef.rb +0 -0
- data/test/gem_runtests.rb +0 -0
- data/test/http/all.rb +0 -0
- data/test/http/copy-from-http.rb +0 -0
- data/test/runalltests.rb +0 -0
- data/test/runftptests.rb +0 -0
- data/test/runhttptests.rb +0 -0
- data/test/runtests.rb +0 -0
- data/test/tc/abs.rb +0 -0
- data/test/tc/all.rb +1 -1
- data/test/tc/base.rb +0 -0
- data/test/tc/base2.rb +0 -0
- data/test/tc/cd1.rb +0 -0
- data/test/tc/clearsel.rb +0 -0
- data/test/tc/clone.rb +0 -0
- data/test/tc/closeoncopy.rb +0 -0
- data/test/tc/closeoneof.rb +0 -0
- data/test/tc/cmdpipe.rb +0 -0
- data/test/tc/copy-dir-samevar.rb +0 -0
- data/test/tc/copy-from.rb +0 -0
- data/test/tc/copy-to.rb +0 -0
- data/test/tc/copy.rb +0 -0
- data/test/tc/copyarray.rb +0 -0
- data/test/tc/copydest.rb +0 -0
- data/test/tc/copydir.rb +0 -0
- data/test/tc/copydirlines.rb +0 -0
- data/test/tc/copylines.rb +0 -0
- data/test/tc/copynonex.rb +0 -0
- data/test/tc/copysymlink.rb +0 -0
- data/test/tc/create.rb +0 -0
- data/test/tc/csv.rb +0 -0
- data/test/tc/csv2.rb +0 -0
- data/test/tc/csv_columns.rb +0 -0
- data/test/tc/csvutil.rb +0 -0
- data/test/tc/dir.rb +0 -0
- data/test/tc/dir_iter.rb +0 -0
- data/test/tc/dirautoclose.rb +0 -0
- data/test/tc/dirent.rb +0 -0
- data/test/tc/dirss.rb +0 -0
- data/test/tc/each.rb +0 -0
- data/test/tc/each_break.rb +0 -0
- data/test/tc/edf.rb +0 -0
- data/test/tc/empty.rb +0 -0
- data/test/tc/emptyriodir.rb +0 -0
- data/test/tc/entary.rb +0 -0
- data/test/tc/entsel.rb +0 -0
- data/test/tc/eq.rb +0 -0
- data/test/tc/expand_path.rb +0 -0
- data/test/tc/ext.rb +0 -0
- data/test/tc/fileno.rb +0 -0
- data/test/tc/files_select.rb +0 -0
- data/test/tc/get.rb +0 -0
- data/test/tc/getrec.rb +0 -0
- data/test/tc/gzip.rb +0 -0
- data/test/tc/io_each_byte.rb +0 -0
- data/test/tc/io_read.rb +0 -0
- data/test/tc/iometh.rb +0 -0
- data/test/tc/likeio.rb +0 -0
- data/test/tc/line_record_row.rb +0 -0
- data/test/tc/lineno.rb +0 -0
- data/test/tc/lines.rb +0 -0
- data/test/tc/misc.rb +0 -0
- data/test/tc/nolines.rb +0 -0
- data/test/tc/noqae.rb +0 -0
- data/test/tc/null.rb +0 -0
- data/test/tc/once.rb +0 -0
- data/test/tc/overload.rb +0 -0
- data/test/tc/pa.rb +0 -0
- data/test/tc/path_parts.rb +2 -1
- data/test/tc/pathop.rb +0 -0
- data/test/tc/paths.rb +0 -0
- data/test/tc/pid.rb +0 -0
- data/test/tc/piper.rb +0 -0
- data/test/tc/programs_util.rb +0 -0
- data/test/tc/qae.rb +0 -0
- data/test/tc/qae_riovar.rb +0 -0
- data/test/tc/readline.rb +0 -0
- data/test/tc/records.rb +0 -0
- data/test/tc/rename.rb +0 -0
- data/test/tc/rename_assign.rb +0 -0
- data/test/tc/riorl.rb +1 -1
- data/test/tc/route.rb +0 -0
- data/test/tc/selnosel.rb +0 -0
- data/test/tc/skip.rb +0 -0
- data/test/tc/skiplines.rb +0 -0
- data/test/tc/split.rb +0 -0
- data/test/tc/splitlines.rb +0 -0
- data/test/tc/splitpath.rb +0 -0
- data/test/tc/sub.rb +0 -0
- data/test/tc/symlink.rb +0 -0
- data/test/tc/symlink0.rb +56 -5
- data/test/tc/symlink1.rb +0 -0
- data/test/tc/temp.rb +0 -0
- data/test/tc/tempdir.rb +0 -0
- data/test/tc/tempfile.rb +0 -0
- data/test/tc/testcase.rb +0 -0
- data/test/tc/tonl.rb +0 -0
- data/test/tc/truncate.rb +0 -0
- data/test/tc/yaml.rb +0 -0
- metadata +593 -274
- data/doc/#RIOIS# +0 -216
@@ -0,0 +1,368 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: RIO::Doc::INDEX</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<meta name="revisit-after" content="5 days">
|
12
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
13
|
+
<script type="text/javascript">
|
14
|
+
// <![CDATA[
|
15
|
+
|
16
|
+
function popupCode( url ) {
|
17
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
18
|
+
}
|
19
|
+
|
20
|
+
function toggleCode( id ) {
|
21
|
+
if ( document.getElementById )
|
22
|
+
elem = document.getElementById( id );
|
23
|
+
else if ( document.all )
|
24
|
+
elem = eval( "document.all." + id );
|
25
|
+
else
|
26
|
+
return false;
|
27
|
+
|
28
|
+
elemStyle = elem.style;
|
29
|
+
|
30
|
+
if ( elemStyle.display != "block" ) {
|
31
|
+
elemStyle.display = "block"
|
32
|
+
} else {
|
33
|
+
elemStyle.display = "none"
|
34
|
+
}
|
35
|
+
|
36
|
+
return true;
|
37
|
+
}
|
38
|
+
|
39
|
+
// Make codeblocks hidden by default
|
40
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
41
|
+
|
42
|
+
// ]]>
|
43
|
+
</script>
|
44
|
+
|
45
|
+
</head>
|
46
|
+
<body>
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
<div id="classHeader">
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td class="class-mod"><strong>Module</strong></td>
|
54
|
+
<td class="class-name-in-header">RIO::Doc::INDEX</td>
|
55
|
+
<td rowspan="2" class="class-header-space-col"></td>
|
56
|
+
<td rowspan="2">
|
57
|
+
<a class="in-url" href="../../../files/lib/rio/doc/INDEX_rb.html">
|
58
|
+
lib/rio/doc/INDEX.rb
|
59
|
+
</a>
|
60
|
+
|
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 © 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>
|
@@ -0,0 +1,1529 @@
|
|
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
|
+
|
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’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’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 (’/’).
|
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: ’-’ 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: ’-’ refers to fileno 1, so
|
270
|
+
’=’ 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
|
+
’#’ )
|
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(?")</tt> (mnemonic: ’"’ 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(?")
|
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 = ""
|
305
|
+
rio(?",astring)
|
306
|
+
</pre>
|
307
|
+
<h5>Creating a Rio that refers to a Temporary object</h5>
|
308
|
+
<p>
|
309
|
+
<tt>rio(??)</tt> (mnemonic: ’?’ you don’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: ’-’ 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: ’`’ (backtick) runs an external
|
351
|
+
program in ruby)
|
352
|
+
</p>
|
353
|
+
<p>
|
354
|
+
This is Rio’s interface to IO#popen
|
355
|
+
</p>
|
356
|
+
<h3>Path Manipulation</h3>
|
357
|
+
<p>
|
358
|
+
Rio’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’s component parts.</h4>
|
363
|
+
<p>
|
364
|
+
The Rio methods for creating a Rio from a Rio’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 #=> rio('afile')
|
386
|
+
rio('afile.txt').filename #=> rio('afile.txt')
|
387
|
+
|
388
|
+
ario = rio('afile.tar.gz')
|
389
|
+
ario.basename #=> rio('afile.tar')
|
390
|
+
ario.ext? #=> ".gz"
|
391
|
+
ario.ext('.tar.gz').basename #=> rio('afile')
|
392
|
+
ario.ext? #=> ".tar.gz"
|
393
|
+
</pre>
|
394
|
+
<h4>Changing a path’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 #=> [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 #=> [rio('a'),rio('b'),rio('c')]
|
430
|
+
ary.to_rio #=> 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') #=> 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) #=> rio('a/b')
|
451
|
+
c = a/b #=> 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' #=> rio('adir/afile.rb')
|
460
|
+
ario.join('b','c','d') #=> rio('adir/b/c/d')
|
461
|
+
ario/'b'/'c'/'d' #=> rio('adir/b/c/d')
|
462
|
+
ario /= 'e' #=> 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 #=> rio('/tmp/a')
|
487
|
+
rio('a').abs('/usr') #=> 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 #=> rio('a')
|
497
|
+
end
|
498
|
+
rio('/tmp/b').rel('/tmp') #=> 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’s configuration methods.
|
511
|
+
</p>
|
512
|
+
<p>
|
513
|
+
Rio’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’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’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’s
|
535
|
+
grande I/O methods
|
536
|
+
</p>
|
537
|
+
</li>
|
538
|
+
</ul>
|
539
|
+
<p>
|
540
|
+
All of Rio’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’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
|
+
’<<’ operator.</b> This is one of Rio’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 ’<<’ 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 ‘string’ and
|
876
|
+
‘string=’
|
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><</tt> (copy-from)
|
932
|
+
|
933
|
+
</li>
|
934
|
+
<li><tt><<</tt> (append-from)
|
935
|
+
|
936
|
+
</li>
|
937
|
+
<li><tt>></tt> (copy-to)
|
938
|
+
|
939
|
+
</li>
|
940
|
+
<li><tt>>></tt> (append-to)
|
941
|
+
|
942
|
+
</li>
|
943
|
+
</ul>
|
944
|
+
<p>
|
945
|
+
The only difference between the ‘copy’ and ‘append’
|
946
|
+
versions is how they deal with an unopened resource. In the former the open
|
947
|
+
it with mode ‘w’ and in the latter, mode ‘a’.
|
948
|
+
Beyond that, their behavior can be summarized as:
|
949
|
+
</p>
|
950
|
+
<pre>
|
951
|
+
source.each do |entry|
|
952
|
+
destination << 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 — Strings and Arrays are
|
959
|
+
also supported.
|
960
|
+
</p>
|
961
|
+
<p>
|
962
|
+
For example:
|
963
|
+
</p>
|
964
|
+
<pre>
|
965
|
+
rio('afile') > astring # copy a file into a string
|
966
|
+
|
967
|
+
rio('afile').chomp > anarray # copy the chomped lines of afile into an array
|
968
|
+
|
969
|
+
rio('afile.gz').gzip.lines(0...100) > rio('bfile') # copy 100 lines from a gzipped file into another file
|
970
|
+
|
971
|
+
rio(?-) < rio('http://rubydoc.org/') # copy a web page to stdout
|
972
|
+
|
973
|
+
rio('bdir') < rio('adir') # copy an entire directory structure
|
974
|
+
|
975
|
+
rio('adir').dirs.files('README') > rio('bdir') # same thing, but only README files
|
976
|
+
|
977
|
+
rio(?-,'ps -a').skiplines(0,/ps$/) > 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' => rio('a')
|
993
|
+
ario.rename!('b') # file 'a' has been renamed to 'b' and 'ario' => 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’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 => adir/bfile.rb
|
1007
|
+
rio('adir/afile.txt').rename.basename = 'bfile' # adir/afile.txt => adir/bfile.txt
|
1008
|
+
rio('adir/afile.txt').rename.extname = '.rb' # adir/afile.txt => adir/afile.rb
|
1009
|
+
rio('adir/afile.txt').rename.dirname = 'b/c' # adir/afile.txt => 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' #=> 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’ 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’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 ‘adir’ named
|
1086
|
+
‘alink’ which references ‘adir/afile’. From the
|
1087
|
+
perspective of ‘alink’, ‘adir/afile’ 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 ‘adir’ named
|
1095
|
+
‘alink’ which references ‘afile’. This is the route
|
1096
|
+
to ‘adir/afile’ from the perspective of
|
1097
|
+
‘adir/alink’.
|
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’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’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 ) #=> ["badger", "tiger", "elephant"]
|
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’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? #=> false
|
1152
|
+
</pre>
|
1153
|
+
<p>
|
1154
|
+
Closing on end-of-file is necessary for many of Rio’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><, <<, >, >></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("Hello World").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’s understanding that
|
1189
|
+
Ruby does not support a mechanism to have code run when there are no more
|
1190
|
+
references to it — that finalizers are not necessarily run immediatly
|
1191
|
+
upon an object’s reference count reaching 0. If this understanding is
|
1192
|
+
incorrect, some of Rio’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 ‘w’, and otherwise opens a file with mode
|
1213
|
+
‘r’. 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
|
+
‘a’,’a+’,’r’,’r+’,’w’,and
|
1222
|
+
‘w+’ 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!("Hello World")
|
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!("Hello Kitty").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’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!(["h0,h1","f0,f1"])
|
1279
|
+
|
1280
|
+
rio('f.csv').csv.records[] #==>[["h0", "h1"], ["f0", "f1"]]
|
1281
|
+
rio('f.csv').csv[] #==> same thing
|
1282
|
+
rio('f.csv').csv.lines[] #==>["h0,h1\n", "f0,f1\n"]
|
1283
|
+
rio('f.csv').csv.records[0] #==>[["h0", "h1"]]
|
1284
|
+
rio('f.csv').csv[0] #==> same thing
|
1285
|
+
rio('f.csv').csv.lines[0] #==>["h0,h1\n"]
|
1286
|
+
rio('f.csv').csv.skiprecords[0] #==>[["f0", "f1"]]
|
1287
|
+
rio('f.csv').csv.skiplines[0] #==>["f0,f1\n"]
|
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] > rio('out').csv # out contains "f0,f1\n"
|
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 ‘out’ 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 [["f0","f1"]] had been called
|
1304
|
+
</p>
|
1305
|
+
<pre>
|
1306
|
+
rio('f.csv').csv[0] > rio('out') # out contains "f0f1"
|
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] #==>["f0,f1\n"]
|
1317
|
+
array_of_records = rio('f.csv').csv.records[1] #==>[["f0", "f1"]]
|
1318
|
+
|
1319
|
+
array_of_lines[0].to_a #==>["f0", "f1"]
|
1320
|
+
array_of_records[0].to_s #==>"f0,f1"
|
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!(["h0;h1","f0;f1"])
|
1329
|
+
|
1330
|
+
rio('semisep').csv(';').to_a #==>[["h0", "h1"], ["f0", "f1"]]
|
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(';') > rio('colonsep').csv(':')
|
1338
|
+
rio('colonsep').contents #==>"h0:h1\nf0:f1\n"
|
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 — <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!(["h0,h1,h2,h3","f0,f1,f2,f3"])
|
1348
|
+
|
1349
|
+
rio('f.csv').csv.columns(0).to_a #==>[["h0"], ["f0"]]
|
1350
|
+
rio('f.csv').csv.skipcolumns(0).to_a #==>[["h1", "h2", "h3"], ["f1", "f2", "f3"]]
|
1351
|
+
rio('f.csv').csv.columns(1..2).to_a #==>[["h1", "h2"], ["f1", "f2"]]
|
1352
|
+
rio('f.csv').csv.skipcolumns(1..2).to_a #==>[["h0", "h3"], ["f0", "f3"]]
|
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) > rio('out').csv
|
1360
|
+
rio('out').contents #==>"h0,h1\nf0,f1\n"
|
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 ‘database.yml’ 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
|
+
==>{"development"=>{"adapter"=>"mysql", "database"=>"rails_development"},
|
1401
|
+
"test"=>{"adapter"=>"mysql", "database"=>"rails_test"}}
|
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
|
+
==>"rails_development"
|
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' => {
|
1417
|
+
'adapter' => 'mysql',
|
1418
|
+
'database' => '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 > 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 © 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>
|