rio 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -1
  3. data/README +1 -1
  4. data/lib/rio.rb +5 -4
  5. data/lib/rio/abstract_method.rb +1 -1
  6. data/lib/rio/alturi.rb +10 -69
  7. data/lib/rio/alturi/algorithm.rb +1 -18
  8. data/lib/rio/alturi/escape.rb +0 -4
  9. data/lib/rio/alturi/parse.rb +0 -29
  10. data/lib/rio/alturi/path_parts.rb +0 -2
  11. data/lib/rio/alturi/uri_parts.rb +3 -32
  12. data/lib/rio/argv.rb +1 -1
  13. data/lib/rio/arraynge.rb +1 -3
  14. data/lib/rio/arycopy.rb +1 -1
  15. data/lib/rio/assert.rb +31 -47
  16. data/lib/rio/base.rb +1 -1
  17. data/lib/rio/callstr.rb +1 -1
  18. data/lib/rio/const.rb +1 -1
  19. data/lib/rio/construct.rb +1 -1
  20. data/lib/rio/constructor.rb +1 -1
  21. data/lib/rio/context.rb +8 -4
  22. data/lib/rio/context/autoclose.rb +1 -1
  23. data/lib/rio/context/binmode.rb +1 -7
  24. data/lib/rio/context/copying.rb +1 -1
  25. data/lib/rio/context/cxx.rb +1 -1
  26. data/lib/rio/context/dir.rb +1 -1
  27. data/lib/rio/context/encoding.rb +1 -2
  28. data/lib/rio/context/gzip.rb +1 -1
  29. data/lib/rio/context/methods.rb +1 -6
  30. data/lib/rio/context/skip.rb +1 -1
  31. data/lib/rio/context/stream.rb +1 -8
  32. data/lib/rio/cp.rb +1 -1
  33. data/lib/rio/cxuri.rb +11 -7
  34. data/lib/rio/dbg/trace_states.rb +0 -2
  35. data/lib/rio/def.rb +1 -1
  36. data/lib/rio/dir.rb +2 -2
  37. data/lib/rio/doc.rb +1 -1
  38. data/lib/rio/entrysel.rb +6 -6
  39. data/lib/rio/exception.rb +1 -1
  40. data/lib/rio/exception/copy.rb +1 -1
  41. data/lib/rio/exception/notimplemented.rb +1 -1
  42. data/lib/rio/exception/notsupported.rb +1 -1
  43. data/lib/rio/exception/open.rb +1 -12
  44. data/lib/rio/exception/state.rb +1 -1
  45. data/lib/rio/ext.rb +1 -8
  46. data/lib/rio/ext/csv.rb +1 -25
  47. data/lib/rio/ext/csv/csv-legacy.rb +1 -49
  48. data/lib/rio/ext/csv/csv.rb +1 -24
  49. data/lib/rio/ext/csv/filter.rb +1 -19
  50. data/lib/rio/ext/if.rb +1 -1
  51. data/lib/rio/ext/mp3info.rb +6 -5
  52. data/lib/rio/ext/splitlines.rb +1 -23
  53. data/lib/rio/ext/yaml.rb +1 -16
  54. data/lib/rio/ext/yaml/doc.rb +1 -6
  55. data/lib/rio/ext/yaml/tie.rb +4 -7
  56. data/lib/rio/ext/zipfile.rb +1 -56
  57. data/lib/rio/ext/zipfile/fs.rb +1 -30
  58. data/lib/rio/ext/zipfile/rl.rb +1 -128
  59. data/lib/rio/ext/zipfile/rootdir.rb +1 -30
  60. data/lib/rio/ext/zipfile/state.rb +1 -105
  61. data/lib/rio/ext/zipfile/wrap.rb +1 -86
  62. data/lib/rio/factory.rb +2 -100
  63. data/lib/rio/fibpipe.rb +0 -98
  64. data/lib/rio/file.rb +1 -12
  65. data/lib/rio/filter.rb +1 -1
  66. data/lib/rio/filter/closeoneof.rb +1 -10
  67. data/lib/rio/filter/gzip.rb +1 -16
  68. data/lib/rio/fs.rb +75 -92
  69. data/lib/rio/fs/base.rb +1 -1
  70. data/lib/rio/fs/impl.rb +1 -1
  71. data/lib/rio/fs/native.rb +1 -1
  72. data/lib/rio/fs/stream.rb +1 -1
  73. data/lib/rio/fs/url.rb +1 -1
  74. data/lib/rio/ftp/conncache.rb +1 -15
  75. data/lib/rio/ftp/dir.rb +1 -2
  76. data/lib/rio/ftp/fs.rb +1 -13
  77. data/lib/rio/fwd.rb +31 -8
  78. data/lib/rio/grande.rb +2 -4
  79. data/lib/rio/handle.rb +1 -1
  80. data/lib/rio/if.rb +1 -7
  81. data/lib/rio/if/basic.rb +1 -5
  82. data/lib/rio/if/csv.rb +1 -1
  83. data/lib/rio/if/dir.rb +1 -1
  84. data/lib/rio/if/file.rb +1 -1
  85. data/lib/rio/if/fileordir.rb +1 -1
  86. data/lib/rio/if/grande.rb +1 -1
  87. data/lib/rio/if/grande_entry.rb +1 -1
  88. data/lib/rio/if/grande_stream.rb +1 -1
  89. data/lib/rio/if/internal.rb +1 -1
  90. data/lib/rio/if/path.rb +1 -1
  91. data/lib/rio/if/rubyio.rb +1 -1
  92. data/lib/rio/if/string.rb +1 -1
  93. data/lib/rio/if/temp.rb +1 -1
  94. data/lib/rio/if/test.rb +1 -1
  95. data/lib/rio/if/yaml.rb +1 -1
  96. data/lib/rio/ioh.rb +42 -24
  97. data/lib/rio/iomode.rb +3 -3
  98. data/lib/rio/ios/fail.rb +1 -1
  99. data/lib/rio/ios/generic.rb +1 -1
  100. data/lib/rio/ios/mode.rb +1 -1
  101. data/lib/rio/ios/null.rb +1 -13
  102. data/lib/rio/iowrap.rb +1 -14
  103. data/lib/rio/kernel.rb +1 -2
  104. data/lib/rio/local.rb +1 -13
  105. data/lib/rio/match.rb +1 -2
  106. data/lib/rio/matchrecord.rb +5 -34
  107. data/lib/rio/no_warn.rb +1 -1
  108. data/lib/rio/nullio.rb +1 -1
  109. data/lib/rio/open3.rb +1 -10
  110. data/lib/rio/ops.rb +1 -1
  111. data/lib/rio/ops/construct.rb +1 -1
  112. data/lib/rio/ops/create.rb +1 -3
  113. data/lib/rio/ops/dir.rb +4 -46
  114. data/lib/rio/ops/either.rb +1 -3
  115. data/lib/rio/ops/file.rb +1 -25
  116. data/lib/rio/ops/path.rb +1 -18
  117. data/lib/rio/ops/stream.rb +4 -5
  118. data/lib/rio/ops/stream/input.rb +1 -10
  119. data/lib/rio/ops/stream/output.rb +1 -3
  120. data/lib/rio/ops/stream/read.rb +1 -1
  121. data/lib/rio/ops/stream/write.rb +1 -1
  122. data/lib/rio/ops/symlink.rb +1 -10
  123. data/lib/rio/path.rb +1 -4
  124. data/lib/rio/path/reset.rb +1 -6
  125. data/lib/rio/piper.rb +1 -4
  126. data/lib/rio/piper/cp.rb +1 -16
  127. data/lib/rio/prompt.rb +1 -1
  128. data/lib/rio/rectype.rb +1 -4
  129. data/lib/rio/rl/base.rb +1 -14
  130. data/lib/rio/rl/builder.rb +1 -12
  131. data/lib/rio/rl/chmap.rb +1 -11
  132. data/lib/rio/rl/fs2url.rb +1 -8
  133. data/lib/rio/rl/ioi.rb +1 -2
  134. data/lib/rio/rl/path.rb +1 -20
  135. data/lib/rio/rl/pathmethods.rb +1 -3
  136. data/lib/rio/rl/uri.rb +1 -11
  137. data/lib/rio/rl/withpath.rb +2 -30
  138. data/lib/rio/rrl/base.rb +1 -6
  139. data/lib/rio/rrl/builder.rb +2 -8
  140. data/lib/rio/rrl/chmap.rb +1 -11
  141. data/lib/rio/rrl/ioi.rb +1 -3
  142. data/lib/rio/rrl/path.rb +1 -11
  143. data/lib/rio/rrl/withpath.rb +8 -48
  144. data/lib/rio/scheme/aryio.rb +1 -1
  145. data/lib/rio/scheme/cmdio.rb +3 -15
  146. data/lib/rio/scheme/cmdpipe.rb +1 -5
  147. data/lib/rio/scheme/fd.rb +1 -1
  148. data/lib/rio/scheme/ftp.rb +1 -40
  149. data/lib/rio/scheme/http.rb +10 -7
  150. data/lib/rio/scheme/null.rb +1 -1
  151. data/lib/rio/scheme/path.rb +1 -63
  152. data/lib/rio/scheme/stderr.rb +1 -2
  153. data/lib/rio/scheme/stdio.rb +3 -3
  154. data/lib/rio/scheme/strio.rb +1 -3
  155. data/lib/rio/scheme/sysio.rb +1 -1
  156. data/lib/rio/scheme/tcp.rb +1 -2
  157. data/lib/rio/scheme/temp.rb +9 -38
  158. data/lib/rio/state.rb +4 -38
  159. data/lib/rio/state/data.rb +4 -5
  160. data/lib/rio/state/error.rb +2 -6
  161. data/lib/rio/stream.rb +1 -31
  162. data/lib/rio/stream/base.rb +1 -5
  163. data/lib/rio/stream/duplex.rb +1 -16
  164. data/lib/rio/stream/open.rb +1 -11
  165. data/lib/rio/symantics.rb +1 -1
  166. data/lib/rio/tempdir.rb +0 -2
  167. data/lib/rio/to_rio.rb +1 -1
  168. data/lib/rio/to_rio/all.rb +1 -1
  169. data/lib/rio/to_rio/array.rb +1 -1
  170. data/lib/rio/to_rio/io.rb +1 -1
  171. data/lib/rio/to_rio/object.rb +1 -1
  172. data/lib/rio/to_rio/string.rb +1 -1
  173. data/lib/rio/undef_rake_dsl.rb +3 -0
  174. data/lib/rio/uri/file.rb +1 -18
  175. data/lib/rio/uriref.rb +1 -18
  176. data/lib/rio/util.rb +1 -1
  177. data/lib/rio/version.rb +2 -2
  178. data/misc/update-copyright.rb +2 -2
  179. data/rio.gemspec +2 -3
  180. data/test/env.sh +1 -2
  181. data/test/http/tc/copy_from_http.rb +0 -1
  182. data/test/runhttp.rb +2 -1
  183. data/test/runtests.rb +7 -5
  184. data/test/tc/copyarray.rb +4 -4
  185. data/test/tc/copydir.rb +1 -1
  186. metadata +15 -47
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 566aa2a70a79f532a79ac92c4ca603dfb170fa86
4
+ data.tar.gz: 822ac8d9e81df21b9712dc65d9f975570b453f0b
5
+ SHA512:
6
+ metadata.gz: b8a4b954b8d997c0355c337b740221ed153f30365c2575dd86f1c288767f05b7e65bed9a7ca900b5fc9bc718a18bbaf1a2d0640b9335da533b460ab9d0944607
7
+ data.tar.gz: 4763841f80976380eea0a2426f1aa3d5668f9d957d10f0a823d52daa321c3eab422f8314a17fc4e5a61f7ea2a022930f65e45794b2847bf66ad521a9beeb0b65
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2005-2012 Christopher Kleckner
1
+ Copyright (c) 2005-2017 Christopher Kleckner
2
2
 
3
3
 
4
4
  GNU GENERAL PUBLIC LICENSE
data/README CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2005-2012 Christopher Kleckner
1
+ Copyright (c) 2005-2017 Christopher Kleckner
2
2
  All rights reserved
3
3
 
4
4
  This file is part of the Rio library for ruby.
data/lib/rio.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -37,8 +37,6 @@ require 'rio/fs'
37
37
  #require 'rio/def'
38
38
  #require 'rio/exception'
39
39
 
40
- require 'forwardable'
41
-
42
40
  $trace_states = false
43
41
 
44
42
  require 'rio/kernel'
@@ -49,6 +47,8 @@ require 'rio/const'
49
47
  require 'rio/local'
50
48
  require 'rio/factory'
51
49
 
50
+ require 'rio/undef_rake_dsl'
51
+
52
52
  module RIO
53
53
  class Rio #:doc:
54
54
  include Local
@@ -109,7 +109,7 @@ module RIO
109
109
  self.class.new(self.rl)
110
110
  end
111
111
 
112
- # needed for 1.9.2+ problem with to_ary and method_missing
112
+ # Returns nil. Needed for 1.9.2+ problem with to_ary and method_missing.
113
113
  def to_ary
114
114
  nil
115
115
  end
@@ -173,6 +173,7 @@ module RIO
173
173
 
174
174
  end # class Rio
175
175
  end # module RIO
176
+
176
177
  module RIO
177
178
  class Rio
178
179
  USE_IF = true #:nodoc:
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -1,4 +1,3 @@
1
- require 'forwardable'
2
1
  require 'rio/alturi/uri_parts'
3
2
  require 'rio/alturi/algorithm'
4
3
  require 'rio/fwd'
@@ -33,6 +32,7 @@ module Alt
33
32
  end
34
33
  end
35
34
  end
35
+
36
36
  module Alt
37
37
  module URI
38
38
  module Ops
@@ -112,12 +112,8 @@ module Alt
112
112
  other.rel(self)
113
113
  end
114
114
  def join(*a)
115
- #p "A=#{a.inspect}"
116
115
  pthstr = a.map(&:to_s).join('/')
117
- #p "DODODODOD",a.map{ |ar| ar.is_a?(::String) ? "#{ar.encoding} #{ar}" : "#{ar}" }
118
- #p pthstr.encoding,pthstr
119
116
  newpth = (self.path + (a.empty? || self.path.empty? ? '' : '/') + pthstr).squeeze('/')
120
- #p "NEWPATH:",newpth.encoding,newpth
121
117
  self.path = newpth
122
118
  end
123
119
 
@@ -125,7 +121,9 @@ module Alt
125
121
  end
126
122
  end
127
123
  end
124
+
128
125
  require 'rio/alturi/path_parts'
126
+
129
127
  module Alt
130
128
  module URI
131
129
  class Base
@@ -160,10 +158,10 @@ module Alt
160
158
  end
161
159
  end
162
160
  end
161
+
163
162
  module Alt
164
163
  module URI
165
164
  class Generic < ::Alt::URI::Base
166
- extend Forwardable
167
165
  extend Builders
168
166
  def initialize(parts=nil)
169
167
  prts = parts || Alt::URI::Gen::URIParts.new
@@ -173,10 +171,6 @@ module Alt
173
171
  super
174
172
  end
175
173
  def normalize
176
-
177
- #if self.host
178
- # self.host = self.scheme ? "" : nil
179
- #end
180
174
  super
181
175
  end
182
176
  include Ops::Generic
@@ -188,7 +182,7 @@ module Alt
188
182
  fwd :parts, :host,:port
189
183
  fwd :parts, :userinfo
190
184
  fwd :parts, :user,:password
191
- def_delegators :parts, :to_s
185
+ fwd_readers :parts, :to_s
192
186
 
193
187
 
194
188
  def netpath
@@ -207,12 +201,6 @@ module Alt
207
201
  alias :fspath :netpath
208
202
  def fspath=(val) netpath = val end
209
203
 
210
- # def abs(base)
211
- # Alt::URI::Generic.new(parts.abs(base.parts))
212
- # end
213
- # def rel(base)
214
- # Alt::URI::Generic.new(parts.rel(base.parts))
215
- # end
216
204
  end
217
205
 
218
206
  end
@@ -221,7 +209,6 @@ end
221
209
  module Alt
222
210
  module URI
223
211
  class File < ::Alt::URI::Base
224
- extend Forwardable
225
212
  extend Builders
226
213
 
227
214
  def initialize(parts=nil)
@@ -239,7 +226,7 @@ module Alt
239
226
  fwd :parts, :authority
240
227
  fwd :parts, :netpath
241
228
  fwd :parts, :host
242
- def_delegators :parts, :to_s
229
+ fwd_reader :parts, :to_s
243
230
 
244
231
  def normalize
245
232
  hst = self.host if self.host and !(self.host == 'localhost' or self.host.empty?)
@@ -285,7 +272,6 @@ end
285
272
  module Alt
286
273
  module URI
287
274
  class HTTP < ::Alt::URI::Base
288
- extend Forwardable
289
275
  extend Builders
290
276
 
291
277
  def initialize(parts=nil)
@@ -303,7 +289,7 @@ module Alt
303
289
  fwd :parts, :authority
304
290
  fwd :parts, :netpath
305
291
  fwd :parts, :host,:port
306
- def_delegators :parts, :to_s
292
+ fwd_readers :parts, :to_s
307
293
 
308
294
  def netpath
309
295
  parts.path
@@ -335,13 +321,9 @@ module Alt
335
321
  end
336
322
  end
337
323
 
338
-
339
-
340
-
341
324
  module Alt
342
325
  module URI
343
326
  class FTP < ::Alt::URI::Base
344
- extend Forwardable
345
327
  extend Builders
346
328
 
347
329
  def initialize(parts=nil)
@@ -361,7 +343,7 @@ module Alt
361
343
  fwd :parts, :host,:port
362
344
  fwd :parts, :userinfo
363
345
  fwd :parts, :user,:password
364
- def_delegators :parts, :to_s
346
+ fwd_reader :parts, :to_s
365
347
 
366
348
 
367
349
  def fspath() self.path end
@@ -378,15 +360,11 @@ module Alt
378
360
  [pth,typ]
379
361
  end
380
362
  def path
381
- #p parts[:path]
382
363
  pth = parts._do_unesc(split_path_type[0])[1..-1]
383
- #Alt::URI.unescape(split_path_type[0])[1..-1]
384
- #parts.path
385
364
  pth
386
365
  end
387
366
  def path=(val)
388
367
  pth = parts._do_esc(val,:path).sub(%r{^/},'%2F')
389
- #pth = Alt::URI.escape(val,:path).sub(%r{^/},'%2F')
390
368
  typ = self.typecode
391
369
  escpath = "/#{pth}" + (typ ? ";type=#{typ}" : "")
392
370
  parts[:path] = escpath
@@ -408,15 +386,6 @@ module Alt
408
386
  parts.uri = val
409
387
  end
410
388
 
411
-
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
-
420
389
  def normalize
421
390
  if self.port == '21'
422
391
  self.port = nil
@@ -437,16 +406,6 @@ module Alt
437
406
  end
438
407
  end
439
408
 
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
409
  module Alt
451
410
  module URI
452
411
  module Factory
@@ -464,7 +423,6 @@ module Alt
464
423
  end
465
424
 
466
425
  def self.parse(str,opts={})
467
- #str = "file:///" + str if str =~ /^[a-zA-Z]:/
468
426
  u = Alt::URI::Gen::URIParts.parse(str,opts)
469
427
  from_parts(u)
470
428
  end
@@ -476,32 +434,15 @@ module Alt
476
434
  end
477
435
  end
478
436
  end
437
+
479
438
  module Alt
480
439
  module URI
481
440
  def self.parse(str,opts={})
482
- #p "Alt::URI.parse str=#{str}"
483
- ans = Factory.parse(str,opts)
484
- #p " ans=#{ans.inspect}"
485
- ans
441
+ Factory.parse(str,opts)
486
442
  end
487
443
  def self.create(hash)
488
444
  Factory.create(hash)
489
445
  end
490
- # def self.escape(str,fld)
491
- # if str
492
- # # str.encode('UTF-8')
493
- # Alt::URI::Escape.escape(str.force_encoding('US-ASCII'),fld)
494
- # end
495
- # end
496
- # def self.unescape(str)
497
- # if str
498
- # ustr = Alt::URI::Escape.unescape(str)
499
- # @encoding ? ustr.force_encoding(@encoding) : ustr
500
- # end
501
- # end
502
446
  end
503
447
  end
504
448
 
505
- if __FILE__ == $0
506
- # TODO Generated stub
507
- end
@@ -42,8 +42,6 @@ module Alt
42
42
  return out.join("/")
43
43
  end
44
44
 
45
-
46
-
47
45
  # 7) The resulting URI components, including any inherited from the
48
46
  # base URI, are recombined to give the absolute form of the URI
49
47
  # reference. Using pseudocode, this would be
@@ -70,16 +68,6 @@ module Alt
70
68
 
71
69
  # return result
72
70
 
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
71
  def self.uri_string(r)
84
72
  ( defined(r.scheme) ? r.scheme + ":" : "") +
85
73
  ( defined(r.authority) ? "//" + r.authority : "") +
@@ -87,15 +75,13 @@ module Alt
87
75
  ( defined(r.query) ? "?" + r.query : "") +
88
76
  ( defined(r.fragment) ? "#" + r.fragment : "")
89
77
  end
78
+
90
79
  def self.authority_string(r)
91
80
  ( defined(r.userinfo) ? r.userinfo + "@" : "") +
92
81
  r.host +
93
82
  ( defined(r.port) ? ":" + r.port : "")
94
83
  end
95
84
 
96
-
97
-
98
-
99
85
  def self.defined(el)
100
86
  !el.nil?
101
87
  end
@@ -307,7 +293,4 @@ module Alt
307
293
  end
308
294
  end
309
295
 
310
- if __FILE__ == $0
311
- # TODO Generated stub
312
- end
313
296
 
@@ -28,12 +28,10 @@ module Alt
28
28
 
29
29
  def self.escape(str,arg)
30
30
  tmp = ""
31
- # p "escape: #{es(str)}"
32
31
  table = (::Symbol === arg ? CHAR_TABLE[arg] : arg)
33
32
  str.each_byte do |b|
34
33
  tmp << table[b]
35
34
  end
36
- #p "escape: tmp=#{es(str)} str.enc=#{str.encoding}"
37
35
  tmp.encode(str.encoding)
38
36
  end
39
37
 
@@ -52,12 +50,10 @@ module Alt
52
50
  UNESCAPE_HASH = build_unescape_hash
53
51
 
54
52
  def self.unescape(estr)
55
- #p "ESTR: #{estr}"
56
53
  ustr = ""
57
54
  pos = 0
58
55
  while npos = estr.index('%',pos)
59
56
  uh = UNESCAPE_HASH[estr[npos,3].upcase]
60
- #p "UH: #{uh.inspect} npos:#{npos} pos:#{pos}"
61
57
  ustr << estr[pos,npos-pos] << uh
62
58
  pos = npos +3
63
59
  end
@@ -15,20 +15,6 @@ module Alt
15
15
  }
16
16
  end
17
17
 
18
- #RE_PARTS = /^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/
19
- # RE_GENERIC0 = %r{
20
- # (?<scheme> [^:/?#]+ ){0}
21
- # (?<authority> [^/?#]* ){0}
22
- # (?<path> [^?#]* ){0}
23
- # (?<query> [^#]* ){0}
24
- # (?<fragment> .* ){0}
25
-
26
- # ( \g<scheme> : )?
27
- # ( // \g<authority> )?
28
- # \g<path>
29
- # ( \? \g<query> )?
30
- # ( \# \g<fragment> )?
31
- # }x
32
18
  RE_GENERIC = %r{
33
19
  (?: ( [^:/?#]+ ) : )?
34
20
  (?: // ( [^/?#]* ) )?
@@ -37,21 +23,6 @@ module Alt
37
23
  (?: \# ( .* ) )?
38
24
  }x
39
25
 
40
- #def self.parse(ustr)
41
- # parse_re(ustr,RE_GENERIC)
42
- #end
43
-
44
- #authority = [ userinfo "@" ] host [ ":" port ]
45
- #RE_AUTHORITY0 = %r{
46
- #(?<userinfo> [^@]+ ){0}
47
- #(?<host> [^:]* ){0}
48
- #(?<port> .* ){0}
49
- #
50
- #( \g<userinfo> @ )?
51
- # \g<host>
52
- #( : \g<port> )?
53
- #}x
54
-
55
26
  RE_AUTHORITY = %r{
56
27
  (?: ( [^@]+ ) @ )?
57
28
  ( [^:]* )
@@ -48,9 +48,7 @@ module Alt
48
48
  private
49
49
 
50
50
  def _en_pos(path,extnm=nil)
51
- # p "en_pos(#{path},#{extnm.inspect})"
52
51
  en = extnm || ::File.extname(path)
53
- # p "en = #{en.inspect}"
54
52
  [path.rindex(en),en.length]
55
53
  end
56
54
  def _bn_pos(path,exnam=nil)
@@ -1,4 +1,3 @@
1
- require 'forwardable'
2
1
  require 'rio/alturi/escape'
3
2
  require 'rio/alturi/parse'
4
3
  require 'rio/alturi/algorithm'
@@ -7,12 +6,13 @@ require 'rio/alturi/algorithm'
7
6
  module Alt
8
7
  module URI
9
8
  class FieldStore
10
- extend Forwardable
9
+ extend RIO::Fwd
11
10
  def initialize(hash)
12
11
  @hash = hash
13
12
  end
14
13
 
15
- def_delegators :@hash, :[]=, :[], :values_at
14
+ fwd_readers :@hash, :values_at
15
+ fwd :@hash, :[]
16
16
 
17
17
  def method_missing(sym,*args,&block)
18
18
  if sym.to_s.end_with? '='
@@ -34,7 +34,6 @@ module Alt
34
34
  str.encode('UTF-8')
35
35
 
36
36
  Alt::URI::Escape.escape(str.force_encoding('US-ASCII'),fld)
37
- #Alt::URI::Escape.escape(str,fld)
38
37
  end
39
38
  end
40
39
  def _do_unesc(str)
@@ -274,13 +273,6 @@ module Alt
274
273
  def initialize(opts={})
275
274
  @store = { :path => "" }
276
275
  @encoding = opts[:encoding]
277
- # p "@encoding=#{@encoding.inspect}"
278
- # p caller[0]
279
- # @encoding = @store[:path].encoding
280
- # p "URIParts",__ENCODING__
281
- # @encoding = Encoding.default_internal
282
- # @encoding = Encoding.find('UTF-8')
283
- # @encoding = __ENCODING__
284
276
  end
285
277
 
286
278
  def initialize_copy(other)
@@ -309,14 +301,6 @@ module Alt
309
301
  u
310
302
  end
311
303
 
312
- # def [](sym)
313
- # __send__(sym)
314
- # end
315
-
316
- # def []=(sym,val)
317
- # __send__(sym.to_s+'=',val)
318
- # end
319
-
320
304
  def [](sym)
321
305
  @store[sym]
322
306
  end
@@ -443,16 +427,7 @@ module Alt
443
427
  @store.clear
444
428
  @store[:path] = ""
445
429
  else
446
- #Alt::URI::Parse::RE_GENERIC.match(val) { |m|
447
- # p "URI_PARTS: #{m.inspect}"
448
- # self.scheme = m[:scheme]
449
- # self.authority = m[:authority]
450
- # @store[:path] = m[:path]
451
- # @store[:query] = m[:query]
452
- # @store[:fragment] = m[:fragment]
453
- #}
454
430
  Alt::URI::Parse::RE_GENERIC.match(val) { |m|
455
- #p "URI_PARTS: #{m.inspect}"
456
431
  self.scheme = m[1]
457
432
  self.authority = m[2]
458
433
  @store[:path] = m[3]
@@ -470,10 +445,6 @@ module Alt
470
445
  self.authority = nil
471
446
  self.path = ""
472
447
  else
473
- #Alt::URI::Parse::RE_GENERIC.match(val) { |m|
474
- # self.authority = m[:authority]
475
- # self.path = m[:path]
476
- #}
477
448
  Alt::URI::Parse::RE_GENERIC.match(val) { |m|
478
449
  self.authority = m[2]
479
450
  self.path = m[3]