rio 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +140 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/doc/ANNOUNCE +87 -0
- data/doc/RELEASE_NOTES +7 -0
- data/doc/rdoc/classes/Kernel.html +9 -9
- data/doc/rdoc/classes/Kernel.src/{M000183.html → M000182.html} +0 -0
- data/doc/rdoc/classes/RIO.html +35 -0
- data/doc/rdoc/classes/RIO.src/M000001.html +4 -4
- data/doc/rdoc/classes/RIO.src/M000002.html +4 -4
- data/doc/rdoc/classes/RIO.src/M000003.html +4 -4
- data/doc/rdoc/classes/RIO/Doc/HOWTO.html +11 -7
- data/doc/rdoc/classes/RIO/Doc/INTRO.html +255 -36
- data/doc/rdoc/classes/RIO/Doc/SYNOPSIS.html +47 -17
- data/doc/rdoc/classes/RIO/Rio.html +1032 -1007
- data/doc/rdoc/classes/RIO/Rio.src/M000011.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000012.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000013.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000014.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000015.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000016.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000017.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000018.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000019.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000020.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000021.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000022.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000023.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000024.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000025.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000026.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000027.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000028.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000029.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000030.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000031.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000032.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000033.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000034.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000035.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000036.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000037.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000038.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000039.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000040.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000041.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000042.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000043.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000044.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000045.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000046.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000047.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000048.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000049.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000050.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000051.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000052.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000053.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000054.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000055.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000056.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000057.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000058.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000059.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000060.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000061.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000062.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000063.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000064.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000065.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000066.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000067.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000068.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000069.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000070.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000071.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000072.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000073.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000074.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000075.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000076.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000077.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000078.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000079.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000080.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000081.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000082.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000083.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000084.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000085.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000086.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000087.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000088.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000089.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000090.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000091.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000092.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000093.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000094.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000095.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000096.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000097.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000098.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000099.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000100.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000101.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000102.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000103.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000104.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000105.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000106.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000107.html +2 -2
- data/doc/rdoc/classes/RIO/Rio.src/M000108.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000109.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000110.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000111.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000112.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000113.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000114.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000115.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000116.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000117.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000118.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000119.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000120.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000121.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000122.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000123.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000124.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000125.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000126.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000127.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000128.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000129.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000130.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000131.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000132.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000133.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000134.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000135.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000136.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000137.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000138.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000139.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000140.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000141.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000142.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000143.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000144.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000145.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000146.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000147.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000148.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000149.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000150.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000151.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000152.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000153.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000154.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000155.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000156.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000157.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000158.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000159.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000160.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000161.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000162.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000163.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000164.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000165.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000166.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000167.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000168.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000169.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000170.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000171.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000172.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000173.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000174.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000175.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000176.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000177.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000178.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000179.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000180.html +3 -3
- data/doc/rdoc/classes/RIO/Rio.src/M000181.html +3 -3
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/lib/rio/constructor_rb.html +1 -1
- data/doc/rdoc/files/lib/rio/doc/HOWTO_rb.html +1 -1
- data/doc/rdoc/files/lib/rio/doc/INTRO_rb.html +1 -1
- data/doc/rdoc/files/lib/rio/doc/SYNOPSIS_rb.html +1 -1
- data/doc/rdoc/files/lib/rio/if/basic_rb.html +1 -1
- data/doc/rdoc/files/lib/rio/if/path_rb.html +1 -1
- data/doc/rdoc/files/lib/rio_rb.html +1 -1
- data/doc/rdoc/fr_method_index.html +154 -155
- data/ex/findinruby +7 -3
- data/ex/findruby +6 -2
- data/lib/rio.rb +1 -1
- data/lib/rio/argv.rb +4 -0
- data/lib/rio/constructor.rb +17 -0
- data/lib/rio/context.rb +1 -1
- data/lib/rio/context/dir.rb +1 -0
- data/lib/rio/context/methods.rb +3 -3
- data/lib/rio/dir.rb +2 -2
- data/lib/rio/doc/HOWTO.rb +11 -6
- data/lib/rio/doc/INTRO.rb +149 -12
- data/lib/rio/doc/SYNOPSIS.rb +26 -13
- data/lib/rio/factory.rb +13 -2
- data/lib/rio/grande.rb +25 -0
- data/lib/rio/if/basic.rb +1 -1
- data/lib/rio/if/path.rb +61 -35
- data/lib/rio/matchrecord.rb +20 -1
- data/lib/rio/ops/dir.rb +2 -3
- data/lib/rio/ops/path.rb +25 -11
- data/lib/rio/ops/stream/input.rb +6 -3
- data/lib/rio/rl/base.rb +3 -2
- data/lib/rio/rl/ioi.rb +2 -1
- data/lib/rio/rl/path.rb +18 -3
- data/lib/rio/rl/uri.rb +8 -4
- data/lib/rio/scheme/cmdio.rb +1 -1
- data/lib/rio/scheme/path.rb +1 -0
- 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 -0
- data/lib/rio/scheme/temp.rb +184 -0
- data/lib/rio/state.rb +17 -6
- data/lib/rio/stream.rb +1 -1
- data/lib/rio/stream/open.rb +1 -1
- data/lib/rio/tempdir.rb +132 -0
- data/lib/rio/version.rb +1 -1
- data/test/tc/all.rb +4 -0
- data/test/tc/copylines.rb +38 -32
- data/test/tc/riorl.rb +104 -0
- data/test/tc/temp.rb +155 -0
- data/test/tc/tempdir.rb +63 -0
- data/test/tc/tempfile.rb +38 -0
- metadata +10 -5
- data/doc/rdoc/classes/RIO/Rio.src/M000182.html +0 -16
- data/lib/rio/scheme/tempfile.rb +0 -104
data/lib/rio/factory.rb
CHANGED
@@ -71,8 +71,14 @@ module RIO
|
|
71
71
|
require 'rio/scheme/stderr'
|
72
72
|
StdErr
|
73
73
|
when 'tempfile'
|
74
|
-
require 'rio/scheme/
|
75
|
-
|
74
|
+
require 'rio/scheme/temp'
|
75
|
+
Temp::File
|
76
|
+
when 'temp'
|
77
|
+
require 'rio/scheme/temp'
|
78
|
+
Temp
|
79
|
+
when 'tempdir'
|
80
|
+
require 'rio/scheme/temp'
|
81
|
+
Temp::Dir
|
76
82
|
when 'strio'
|
77
83
|
require 'rio/scheme/strio'
|
78
84
|
StrIO
|
@@ -165,6 +171,11 @@ module RIO
|
|
165
171
|
'HTTP::Stream::Input' => 'rio/scheme/http',
|
166
172
|
'HTTP::Stream::Open' => 'rio/scheme/http',
|
167
173
|
|
174
|
+
'Temp::Reset' => 'rio/scheme/temp',
|
175
|
+
'Temp::Stream::Open' => 'rio/scheme/temp',
|
176
|
+
'Temp::Stream::Close' => 'rio/scheme/temp',
|
177
|
+
'Temp::Stream::InOut' => 'rio/scheme/temp',
|
178
|
+
|
168
179
|
'FTP::State::Dir' => 'rio/ftp',
|
169
180
|
'FTP::State::File' => 'rio/ftp',
|
170
181
|
'FTP::State::Reset' => 'rio/ftp',
|
data/lib/rio/grande.rb
CHANGED
@@ -48,6 +48,31 @@ module RIO
|
|
48
48
|
return to_a()
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
def fixnumss(*args)
|
53
|
+
#p "#{callstr('[]',*args)} ss_type=#{cx['ss_type']} stream_iter=#{stream_iter?}"
|
54
|
+
#p args[0].class,ss_type?(_ss_keys())
|
55
|
+
ss_args = cx['ss_args'] = args
|
56
|
+
if ss_args.length == 1 and ss_args[0].kind_of?(Fixnum) and !cx.has_key?('dirlines')
|
57
|
+
ans = nil
|
58
|
+
ss_type = ss_type?(_ss_keys())
|
59
|
+
|
60
|
+
if ss_args and ss_type
|
61
|
+
ans = self.__send__(ss_type,*(ss_args)).to_a
|
62
|
+
else
|
63
|
+
ans = to_a()
|
64
|
+
end
|
65
|
+
|
66
|
+
return (ans.empty? ? nil : ans[0])
|
67
|
+
else
|
68
|
+
if ss_args and (ss_type = ss_type?(_ss_keys()))
|
69
|
+
return self.__send__(ss_type,*(ss_args)).to_a
|
70
|
+
else
|
71
|
+
return to_a()
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
51
76
|
end
|
52
77
|
end
|
53
78
|
module RIO
|
data/lib/rio/if/basic.rb
CHANGED
data/lib/rio/if/path.rb
CHANGED
@@ -40,28 +40,32 @@ module RIO
|
|
40
40
|
|
41
41
|
# Returns the path for the Rio, which is defined differently for different types of Rios.
|
42
42
|
#
|
43
|
-
# For Rios representing paths on the underlying file system this
|
44
|
-
# depending on whether the Rio is absolute or not.
|
45
|
-
#
|
43
|
+
# For Rios representing paths on the underlying file system this returns
|
44
|
+
# URI::FILE#path or URI::Generic#path depending on whether the Rio is absolute or not.
|
45
|
+
# Note that this is not necessarily the same as Rio#fspath, but rather
|
46
|
+
# a URL path as defined in RFC1738.
|
46
47
|
#
|
47
|
-
# For
|
48
|
+
# For Rios that have a URI representation this returns URI#path
|
48
49
|
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
# Specifically:
|
52
|
-
# '-' => stdio:
|
53
|
-
# '=' => stderr:
|
54
|
-
# '?' => tempfile:
|
55
|
-
# '$' => stringio:
|
56
|
-
# '_' => sysio:
|
57
|
-
#
|
58
|
-
# This list of possible paths may not be comprehensive as new types of Rios are added, however,
|
59
|
-
# A Rio should always return a path when the underlying object has a concept of a path and something
|
60
|
-
# else that is reasonable for Rios that have no such concept
|
50
|
+
# Otherwise this returns nil.
|
61
51
|
#
|
62
52
|
def path(*args) target.path(*args) end
|
63
53
|
|
54
|
+
# For resources that have a absolute URL (RFC1738) representation,
|
55
|
+
# this returns a string containing that representation.
|
56
|
+
# For objects that do not this returns a RIORL (a descriptive pseudo-URL).
|
57
|
+
#
|
58
|
+
# rio('/var/www/') #=> "file:///var/www/"
|
59
|
+
# rio('http://rio.rubyforge.org/') #=> "http://rio.rubyforge.org"
|
60
|
+
#
|
64
61
|
def to_url() target.to_url end
|
62
|
+
|
63
|
+
# For resources that have a URL (RFC1738) representation, this returns a
|
64
|
+
# URI object referencing it. Otherwise this raises NoMethodError.
|
65
|
+
#
|
66
|
+
# rio('http://rubyforge.org/').to_uri #=> <URI::HTTP:0x818bd84 URL:http://rubyforge.org/>
|
67
|
+
# rio('adir/afile').to_uri #=> <URI::Generic:0x817d288 URL:adir/afile>
|
68
|
+
#
|
65
69
|
def to_uri() target.to_uri end
|
66
70
|
|
67
71
|
# Returns the path for the Rio on the underlying file system
|
@@ -97,6 +101,17 @@ module RIO
|
|
97
101
|
def rel(other) target.rel(other) end
|
98
102
|
|
99
103
|
|
104
|
+
# Returns a new Rio whose path is the base path that is used by
|
105
|
+
# Rio#abs to create an absolute Rio from a relative one.
|
106
|
+
#
|
107
|
+
# rio('/tmp').chdir
|
108
|
+
# rio('afile').base # => rio('/tmp/')
|
109
|
+
#
|
110
|
+
# See Rio#abs.
|
111
|
+
#
|
112
|
+
def base() target.base() end
|
113
|
+
|
114
|
+
|
100
115
|
# Sets the string that the Rio considers an extension. The value will be used by
|
101
116
|
# subsequent calls to Rio#basename. If called with no arguments resets its value
|
102
117
|
# to the value returned by File#extname. Returns the Rio
|
@@ -308,14 +323,26 @@ module RIO
|
|
308
323
|
|
309
324
|
# Create a Rio referencing Rio#to_s + arg.to_s
|
310
325
|
#
|
326
|
+
# rio('afile') + '-0.1' #=> rio('afile-0.1')
|
327
|
+
#
|
311
328
|
def +(arg) target + arg end
|
312
329
|
|
313
330
|
# Create a new Rio referencing the result of applying String#sub to the value returned by
|
314
|
-
# Rio#to_s
|
331
|
+
# Rio#to_s. So:
|
332
|
+
#
|
333
|
+
# ario.sub(re,string)
|
334
|
+
# is equivelent to
|
335
|
+
# rio(ario.to_s.sub(re,string))
|
336
|
+
#
|
315
337
|
def sub(re,string) target.sub(re,string) end
|
316
338
|
|
317
339
|
# Create a new Rio referencing the result of applying String#gsub to the value returned by
|
318
|
-
# Rio#to_s
|
340
|
+
# Rio#to_s. So:
|
341
|
+
#
|
342
|
+
# ario.gsub(re,string)
|
343
|
+
# is equivelent to
|
344
|
+
# rio(ario.to_s.gsub(re,string))
|
345
|
+
#
|
319
346
|
def gsub(re,string) target.gsub(re,string) end
|
320
347
|
|
321
348
|
|
@@ -359,49 +386,48 @@ module RIO
|
|
359
386
|
##def getwd(*args,&block) target.getwd(*args,&block) end
|
360
387
|
|
361
388
|
|
362
|
-
# Rio#
|
363
|
-
#
|
364
|
-
#
|
365
|
-
def base() target.base() end
|
366
|
-
|
367
|
-
|
368
|
-
# Returns the scheme for Rio's URI like URI#scheme where the Rio is represented
|
389
|
+
# Returns the scheme for the Rio's URI like URI#scheme where the Rio is represented
|
369
390
|
# by a standard URI. For Rios that are not represented by standard URIs one of
|
370
|
-
# Rio's non-standard schemes
|
391
|
+
# Rio's non-standard schemes is returned.
|
371
392
|
#
|
372
|
-
# rio('http://ruby-doc.org/') #=> 'http'
|
393
|
+
# rio('http://ruby-doc.org/').scheme #=> 'http'
|
373
394
|
#
|
374
395
|
def scheme(*args) target.scheme(*args) end
|
375
396
|
|
376
|
-
#
|
397
|
+
# Calls URI#host for Rios which have a URI. Otherwise raises NoMethodError.
|
377
398
|
#
|
378
|
-
# rio('http://ruby-doc.org/') #=> 'ruby-doc'
|
399
|
+
# rio('http://ruby-doc.org/').host #=> 'ruby-doc'
|
379
400
|
#
|
380
401
|
def host(*args) target.host(*args) end
|
381
402
|
|
382
|
-
#
|
403
|
+
# Calls URI#opaque for Rios which have URI representations. The opaque portion
|
404
|
+
# of a URI is the portion after the colon and before the question-mark beginning
|
405
|
+
# the query.
|
406
|
+
#
|
407
|
+
# rio('http://example.org/do.cgi?n=1').opaque #=> '//example.org/do.cgi'
|
383
408
|
#
|
409
|
+
# For Rios that do not have URL representations, returns the same part of
|
410
|
+
# Rio's internal psuedo-URL
|
384
411
|
def opaque(*args) target.opaque(*args) end
|
385
412
|
|
386
413
|
|
387
414
|
|
388
|
-
#
|
415
|
+
# Calls URI#merge
|
389
416
|
#
|
390
|
-
# Merges
|
417
|
+
# Merges two Rios. URI#merge does not document exactly what merging to URIs means. This appears to
|
391
418
|
# join the the paths with like <tt>other + path</tt>. See URI#merge for less information.
|
392
419
|
#
|
393
|
-
#
|
394
420
|
def merge(other) target.merge(other) end
|
395
421
|
|
396
422
|
|
397
|
-
#
|
423
|
+
# Calls URI#route_from
|
398
424
|
#
|
399
425
|
# Returns a new rio representing the path to this Rio from the perspective of _other_.
|
400
426
|
# URI#route_from requires that absolute URIs be used. Rio#route_from does not.
|
401
427
|
#
|
402
428
|
def route_from(other) target.route_from(other) end
|
403
429
|
|
404
|
-
#
|
430
|
+
# Calls URI#route_to
|
405
431
|
#
|
406
432
|
# Returns a new rio representing the path to _other_ from the perspective of this Rio.
|
407
433
|
# URI#route_to requires that absolute URIs be used. Rio#route_to does not.
|
data/lib/rio/matchrecord.rb
CHANGED
@@ -80,6 +80,16 @@ module RIO
|
|
80
80
|
@select_arg === record.recno
|
81
81
|
end
|
82
82
|
end
|
83
|
+
class Fixnum < Base
|
84
|
+
def match?(val,recno)
|
85
|
+
#p "match?(#{val},#{recno}) select_arg=#{@select_arg}"
|
86
|
+
@select_arg === recno
|
87
|
+
end
|
88
|
+
def =~(record)
|
89
|
+
#p "=~(#{record},#{record.recno}) select_arg=#{@select_arg}"
|
90
|
+
@select_arg === record.recno
|
91
|
+
end
|
92
|
+
end
|
83
93
|
class Proc < Base
|
84
94
|
def initialize(arg,therio)
|
85
95
|
super(arg)
|
@@ -127,6 +137,10 @@ module RIO
|
|
127
137
|
def inspect
|
128
138
|
@list.inspect
|
129
139
|
end
|
140
|
+
def size() @list.size unless @list.nil? end
|
141
|
+
def only_one_fixnum?()
|
142
|
+
@list && @list.size == 1 && @list[0].kind_of?(Match::Record::Fixnum)
|
143
|
+
end
|
130
144
|
def delete_at(index)
|
131
145
|
@list.delete_at(index)
|
132
146
|
@list = nil if @list.empty?
|
@@ -157,8 +171,10 @@ module RIO
|
|
157
171
|
Match::Record::Proc.new(arg,therio)
|
158
172
|
when ::Symbol
|
159
173
|
Match::Record::Symbol.new(arg)
|
174
|
+
when ::Fixnum
|
175
|
+
Match::Record::Fixnum.new(arg)
|
160
176
|
else
|
161
|
-
|
177
|
+
raise ArgumentError,"Argument must be a Regexp,Range,Fixnum,Proc, or Symbol"
|
162
178
|
end
|
163
179
|
end
|
164
180
|
def match?(val,recno)
|
@@ -188,6 +204,9 @@ module RIO
|
|
188
204
|
@rej = SelList.create(therio,rej_args)
|
189
205
|
@always = init_always()
|
190
206
|
end
|
207
|
+
def only_one_fixnum?()
|
208
|
+
@rej.nil? && @sel && @sel.only_one_fixnum?
|
209
|
+
end
|
191
210
|
def init_always(reset=false)
|
192
211
|
if @sel.nil? and @rej.nil?
|
193
212
|
!reset
|
data/lib/rio/ops/dir.rb
CHANGED
@@ -137,14 +137,13 @@ module RIO
|
|
137
137
|
alias :unlink :rmdir
|
138
138
|
|
139
139
|
def chdir(*args,&block)
|
140
|
-
ndir = new_rio('.')
|
141
140
|
if block_given?
|
142
141
|
Impl::U.chdir(self,*args) { |dir|
|
143
|
-
yield
|
142
|
+
yield new_rio('.')
|
144
143
|
}
|
145
144
|
else
|
146
145
|
Impl::U.chdir(self,*args)
|
147
|
-
return
|
146
|
+
return new_rio('.')
|
148
147
|
end
|
149
148
|
self
|
150
149
|
end
|
data/lib/rio/ops/path.rb
CHANGED
@@ -109,7 +109,11 @@ module RIO
|
|
109
109
|
new_rio(rl.merge(ensure_rio(other).rl))
|
110
110
|
end
|
111
111
|
def base(b=nil)
|
112
|
-
new_rio(rl.base)
|
112
|
+
new_rio(rl.base(b))
|
113
|
+
end
|
114
|
+
def setbase(b)
|
115
|
+
rl.base(b)
|
116
|
+
self
|
113
117
|
end
|
114
118
|
extend Forwardable
|
115
119
|
def_instance_delegators(:rl,:scheme,:host,:opaque)
|
@@ -124,14 +128,6 @@ module RIO
|
|
124
128
|
en = Impl::U.extname(rl.path_no_slash,*args)
|
125
129
|
(en.empty? ? nil : en)
|
126
130
|
end
|
127
|
-
def basename(*args)
|
128
|
-
unless args.empty?
|
129
|
-
ex = args[0] || self.extname
|
130
|
-
self.ext(ex)
|
131
|
-
end
|
132
|
-
#p self.ext?.inspect
|
133
|
-
new_rio(Impl::U.basename(rl.path_no_slash,self.ext?))
|
134
|
-
end
|
135
131
|
def split()
|
136
132
|
require 'rio/to_rio'
|
137
133
|
pth = rl.path_no_slash
|
@@ -142,10 +138,28 @@ module RIO
|
|
142
138
|
parts[0] = rooturi
|
143
139
|
end
|
144
140
|
# give each rio the correct base
|
145
|
-
parts.inject([rio(parts.shift)]) { |ary,d| ary << rio(d,ary[-1].abs.to_url+'/') }.extend(ToRio::Array)
|
141
|
+
parts.inject([rio(parts.shift)]) { |ary,d| ary << rio(d,{ 'base' => ary[-1].abs.to_url+'/'} ) }.extend(ToRio::Array)
|
142
|
+
end
|
143
|
+
def basename(*args)
|
144
|
+
unless args.empty?
|
145
|
+
ex = args[0] || self.extname
|
146
|
+
self.ext(ex)
|
147
|
+
end
|
148
|
+
#p self.ext?.inspect
|
149
|
+
fn = Impl::U.basename(rl.path_no_slash,self.ext?)
|
150
|
+
new_rio(fn,{'base' => _calc_base()})
|
146
151
|
end
|
147
152
|
def filename()
|
148
|
-
|
153
|
+
fn = Impl::U.basename(rl.path_no_slash)
|
154
|
+
new_rio(fn,{'base' => _calc_base()})
|
155
|
+
end
|
156
|
+
def _calc_base()
|
157
|
+
dn = Impl::U.dirname(rl.path_no_slash)
|
158
|
+
if dn[0] == ?/
|
159
|
+
dn
|
160
|
+
else
|
161
|
+
self.base.to_url + dn + '/'
|
162
|
+
end
|
149
163
|
end
|
150
164
|
def dirname(*args)
|
151
165
|
new_rio(Impl::U.dirname(rl.path_no_slash,*args))
|
data/lib/rio/ops/stream/input.rb
CHANGED
@@ -90,6 +90,11 @@ module RIO
|
|
90
90
|
return to_rec_(raw_rec) if @get_selrej.match?(raw_rec,@recno)
|
91
91
|
end
|
92
92
|
end
|
93
|
+
private
|
94
|
+
|
95
|
+
def _ss_like_array(selrej)
|
96
|
+
selrej.only_one_fixnum? and !dir_iter?
|
97
|
+
end
|
93
98
|
|
94
99
|
protected
|
95
100
|
|
@@ -103,9 +108,7 @@ module RIO
|
|
103
108
|
each_rec_ do |raw_rec|
|
104
109
|
_got_rec(raw_rec)
|
105
110
|
rangetops = check_passed_ranges(selrej,@recno) if rangetops and @recno > rangetops[0]
|
106
|
-
as = selrej.match?(raw_rec,@recno)
|
107
|
-
#p "as: #{as.inspect}" unless as == true || as == false
|
108
|
-
if as
|
111
|
+
if as = selrej.match?(raw_rec,@recno)
|
109
112
|
if want_ma
|
110
113
|
yield(to_rec_(raw_rec),as)
|
111
114
|
else
|
data/lib/rio/rl/base.rb
CHANGED
@@ -47,7 +47,7 @@ module RIO
|
|
47
47
|
'-' => 'stdio',
|
48
48
|
'=' => 'stderr',
|
49
49
|
'"' => 'strio',
|
50
|
-
'?' => '
|
50
|
+
'?' => 'temp',
|
51
51
|
'[' => 'aryio',
|
52
52
|
'`' => 'cmdio',
|
53
53
|
'#' => 'fd',
|
@@ -56,7 +56,7 @@ module RIO
|
|
56
56
|
?- => 'stdio',
|
57
57
|
?= => 'stderr',
|
58
58
|
?" => 'strio',
|
59
|
-
?? => '
|
59
|
+
?? => 'temp',
|
60
60
|
?[ => 'aryio',
|
61
61
|
?` => 'cmdio',
|
62
62
|
?# => 'fd',
|
@@ -133,6 +133,7 @@ module RIO
|
|
133
133
|
def =~(other) other =~ self.to_s end
|
134
134
|
def length() self.to_s.length end
|
135
135
|
def fspath() nil end
|
136
|
+
def path() nil end
|
136
137
|
|
137
138
|
def to_rl() self.rl end
|
138
139
|
|
data/lib/rio/rl/ioi.rb
CHANGED
@@ -44,7 +44,8 @@ module RIO
|
|
44
44
|
def scheme() self.class.const_get(:RIOSCHEME) end
|
45
45
|
def opaque() '' end
|
46
46
|
def self.splitrl(s) nil end
|
47
|
-
def path() self.class.const_get(:RIOPATH) end
|
47
|
+
#def path() self.class.const_get(:RIOPATH) end
|
48
|
+
def path() nil end
|
48
49
|
def fspath() nil end
|
49
50
|
def to_s() url() end
|
50
51
|
end
|
data/lib/rio/rl/path.rb
CHANGED
@@ -57,8 +57,19 @@ module RIO
|
|
57
57
|
@pth = pth
|
58
58
|
@uri= nil
|
59
59
|
end
|
60
|
+
@pth.sub!(%r|/\.$|,'/')
|
61
|
+
@wd = nil
|
62
|
+
if !args.empty? and args[-1].kind_of?(::Hash) and (b = args.pop['base'])
|
63
|
+
@wd = case b
|
64
|
+
when %r%^file://(localhost)?(/.*)?$% then $2 || '/'
|
65
|
+
when %r%^/% then b
|
66
|
+
else RL.fs2url(::Dir.getwd)+'/'+b
|
67
|
+
end
|
68
|
+
@wd.squeeze('/')
|
69
|
+
end
|
60
70
|
self.join(*args) unless args.empty?
|
61
|
-
@wd =
|
71
|
+
@wd = @pth if @pth[0] == ?/
|
72
|
+
@wd = RL.fs2url(::Dir.getwd)+'/' unless @wd
|
62
73
|
end
|
63
74
|
|
64
75
|
def parse_url(str)
|
@@ -98,7 +109,6 @@ module RIO
|
|
98
109
|
def to_s() RL.url2fs(@pth) end
|
99
110
|
|
100
111
|
def self.splitrl(s)
|
101
|
-
|
102
112
|
sch,opq,whole = split_riorl(s)
|
103
113
|
case sch
|
104
114
|
when 'file' then [whole]
|
@@ -124,7 +134,12 @@ module RIO
|
|
124
134
|
def merge(other)
|
125
135
|
self.class.new(uri.merge(other.uri))
|
126
136
|
end
|
127
|
-
def base()
|
137
|
+
def base(arg=nil)
|
138
|
+
unless arg.nil?
|
139
|
+
self.wd = arg
|
140
|
+
end
|
141
|
+
(absolute? ? @pth : @wd)
|
142
|
+
end
|
128
143
|
|
129
144
|
def abs()
|
130
145
|
return self if absolute?
|