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
@@ -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,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.
@@ -126,7 +126,7 @@ module RIO
126
126
 
127
127
  def check?() true end
128
128
  def when_missing(sym,*args)
129
- # p callstr('when_missing',sym,*args)
129
+ # p callstr('when_missing',sym,*args)
130
130
  self.close_.retryreset()
131
131
  end
132
132
  end
@@ -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,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.
@@ -28,7 +28,7 @@ class ::Object #:nodoc: all
28
28
  def true?() true end
29
29
  def false?() false end
30
30
  end
31
- # 2314
31
+
32
32
  module RIO
33
33
  module Match #:nodoc: all
34
34
  module Entry
@@ -91,8 +91,8 @@ module RIO
91
91
  end
92
92
  def create(arg)
93
93
  case arg
94
- when ::Fixnum then Depth.new(arg)
95
- when ::Range then Depth.new(arg)
94
+ when ::Integer then Depth.new(arg)
95
+ when ::Range then Depth.new(arg)
96
96
  when ::String then Glob.new(arg)
97
97
  when ::Regexp then Regexp.new(arg)
98
98
  when ::Proc then Proc.new(arg)
@@ -129,8 +129,8 @@ module RIO
129
129
  def =~(el)
130
130
  el.__send__(@sym) and (@list.empty? or @list.detect { |sel| sel =~ el })
131
131
  end
132
- extend Forwardable
133
- def_instance_delegators(:@list,:each)
132
+ extend RIO::Fwd
133
+ fwd_readers :@list,:each
134
134
  def callstr(func,*args)
135
135
  self.class.to_s+'['+self.to_s+']'+'.'+func.to_s+'('+args.join(',')+')'
136
136
  end
@@ -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,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,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,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,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.
@@ -33,17 +33,6 @@ module RIO
33
33
  @syserr = syse
34
34
  end
35
35
  def explain()
36
- # s = "#{self.class}: failed copying '#{@src}' => #{@dst}"
37
- # s += submsg("Err: #{@syserr}") if @syserr
38
- # s += submsg("Src: '#{@src}' " + finfo(@src))
39
- # s += submsg("Dst: '#{@dst}' " + finfo(@dst))
40
- # target = ::RIO::rio(@dst,@src.filename) if @dst.dir?
41
- # p target
42
- # if target.exist?
43
- # s += submsg("Tgt: '#{target} " + finfo(target))
44
- # end
45
-
46
- # s += "\n"
47
36
  end
48
37
  end
49
38
  end
@@ -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,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.
@@ -22,12 +22,6 @@
22
22
  #++
23
23
  #
24
24
 
25
-
26
- #require 'rio/ext/csv'
27
- #require 'rio/ext/splitlines'
28
- #require 'rio/ext/yaml'
29
- #require 'rio/ext/zipfile'
30
-
31
25
  require 'rio/util'
32
26
  module RIO
33
27
  module Ext
@@ -99,7 +93,6 @@ module RIO
99
93
  end
100
94
  end
101
95
 
102
-
103
96
  module RIO
104
97
  module Ext #:nodoc: all
105
98
  OUTPUT_SYMS = Util::build_sym_hash(CSV::Output.instance_methods + YAML::Output.instance_methods)
@@ -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.
@@ -22,37 +22,15 @@
22
22
  #++
23
23
  #
24
24
 
25
-
26
- # begin
27
- # require 'faster_csv' # first choice--for speed
28
-
29
- # # A CSV compatible interface for FasterCSV.
30
- # module CSV # :nodoc:
31
- # def self.parse_line( line, field_sep=nil, row_sep=nil )
32
- # FasterCSV.parse_line( line, :col_sep => field_sep || ",",
33
- # :row_sep => row_sep || :auto )
34
- # end
35
-
36
- # def self.generate_line( array, field_sep=nil, row_sep=nil )
37
- # FasterCSV.generate_line( array, :col_sep => field_sep || ",",
38
- # :row_sep => row_sep || "" )
39
- # end
40
- # end
41
- # rescue LoadError
42
- # require 'csv' # second choice--slower but standard
43
- # end
44
-
45
25
  $USE_FASTER_CSV = false
46
26
  if RUBY_VERSION[0,3] >= '1.9'
47
27
  require 'csv'
48
28
  require 'rio/ext/csv/csv'
49
29
  $USE_FASTER_CSV = true
50
- # p 'FASTER CSV 1.9'
51
30
  else
52
31
  begin
53
32
  CSV.const_defined?('Reader')
54
33
  require 'rio/ext/csv/csv-legacy'
55
- # p 'LEGACY CSV'
56
34
  rescue NameError
57
35
  begin
58
36
  require 'faster_csv'
@@ -60,11 +38,9 @@ else
60
38
  end
61
39
  require 'rio/ext/csv/csv'
62
40
  $USE_FASTER_CSV = true
63
- # p 'FASTER CSV'
64
41
  rescue LoadError
65
42
  require 'csv'
66
43
  require 'rio/ext/csv/csv-legacy'
67
- # p 'LEGACY CSV'
68
44
  end
69
45
  end
70
46
  end
@@ -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.
@@ -22,27 +22,6 @@
22
22
  #++
23
23
  #
24
24
 
25
-
26
- # begin
27
- # require 'faster_csv' # first choice--for speed
28
-
29
- # # A CSV compatible interface for FasterCSV.
30
- # module CSV # :nodoc:
31
- # def self.parse_line( line, field_sep=nil, row_sep=nil )
32
- # FasterCSV.parse_line( line, :col_sep => field_sep || ",",
33
- # :row_sep => row_sep || :auto )
34
- # end
35
-
36
- # def self.generate_line( array, field_sep=nil, row_sep=nil )
37
- # FasterCSV.generate_line( array, :col_sep => field_sep || ",",
38
- # :row_sep => row_sep || "" )
39
- # end
40
- # end
41
- # rescue LoadError
42
- # require 'csv' # second choice--slower but standard
43
- # end
44
-
45
-
46
25
  $EXTEND_CSV_RESULTS = false
47
26
  module RIO
48
27
  module Ext
@@ -106,26 +85,7 @@ module RIO
106
85
  module Input
107
86
 
108
87
  protected
109
- # def ior()
110
- # p cx['stream_itertype']
111
- # case cx['stream_itertype']
112
- # when 'lines',nil
113
- # self.ioh.iostack[-2]
114
- # else
115
- # self.ioh
116
- # end
117
- # end
118
- # def each_rec_(&block)
119
- # self.ior.each { |line|
120
- # yield line
121
- # }
122
- # self
123
- # end
124
-
125
88
  def to_rec_(raw_rec)
126
- #return raw_rec
127
- #_init_cols_from_line(raw_rec) if @recno == 0
128
- #p "#{callstr('to_rec_',raw_rec.inspect,@recno)} ; itertype=#{cx['stream_itertype']}"
129
89
  case cx['stream_itertype']
130
90
  when 'lines'
131
91
  if $EXTEND_CSV_RESULTS
@@ -182,9 +142,7 @@ module RIO
182
142
  tfields
183
143
  end
184
144
  def parse_line_(line)
185
- #h = {:col_sep => fs, :row_sep => rs}
186
145
  line.chomp!
187
- #p line
188
146
  ::CSV.parse_line(line,*cx['csv_args'])
189
147
  end
190
148
  def _l2a(line)
@@ -199,10 +157,6 @@ module RIO
199
157
  fields.csv_rec_to_s = _rec_to_s_proc(*cx['csv_args'])
200
158
  end
201
159
  end
202
- # p "csv#fields: #{fields}"
203
- # fields.each do |f|
204
- # p f
205
- # end
206
160
  fields.map{ |f| f.to_s }
207
161
  end
208
162
  def cnames(num)
@@ -332,8 +286,6 @@ module RIO
332
286
 
333
287
  def _ary_to_line(ary,*csv_args)
334
288
  rs ||= $/
335
- #h = {:col_sep => fs, :row_sep => rs}
336
- #p 'HERE',csv_args
337
289
  ::CSV.generate_line(ary,*csv_args)
338
290
  end
339
291
  public
@@ -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.
@@ -22,26 +22,6 @@
22
22
  #++
23
23
  #
24
24
 
25
-
26
- # begin
27
- # require 'faster_csv' # first choice--for speed
28
-
29
- # # A CSV compatible interface for FasterCSV.
30
- # module CSV # :nodoc:
31
- # def self.parse_line( line, field_sep=nil, row_sep=nil )
32
- # FasterCSV.parse_line( line, :col_sep => field_sep || ",",
33
- # :row_sep => row_sep || :auto )
34
- # end
35
-
36
- # def self.generate_line( array, field_sep=nil, row_sep=nil )
37
- # FasterCSV.generate_line( array, :col_sep => field_sep || ",",
38
- # :row_sep => row_sep || "" )
39
- # end
40
- # end
41
- # rescue LoadError
42
- # require 'csv' # second choice--slower but standard
43
- # end
44
-
45
25
  class StringIO
46
26
  def to_io() self end
47
27
  end
@@ -154,7 +134,6 @@ module RIO
154
134
  self.ior.gets
155
135
  end
156
136
  def cpto_string_(arg)
157
- #p "CSV: cpto_string_(#{arg}) itertype=#{cx['stream_itertype']}"
158
137
  if cx['stream_itertype'].nil?
159
138
  get_type('lines') { super }
160
139
  else
@@ -347,8 +326,6 @@ module RIO
347
326
  def _ary_to_line(ary,*csv_args)
348
327
  rs ||= $/
349
328
  _csv_options(csv_args)
350
- #h = {:col_sep => fs, :row_sep => rs}
351
- #p 'HERE',csv_args
352
329
  ::CSV.generate_line(ary,*csv_args)
353
330
  end
354
331
  public
@@ -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.
@@ -38,7 +38,6 @@ module RIO
38
38
  require 'rio/arraynge'
39
39
  ycols = _fields_to_columns(row,cx['col_args']) unless cx['col_args'].nil?
40
40
  ncols = _fields_to_columns(row,cx['nocol_args']) unless cx['nocol_args'].nil?
41
- #p "ycols=#{ycols.inspect} ncols=#{ncols.inspect}"
42
41
  if ncols and ncols.empty?
43
42
  cx['csv_columns'] = []
44
43
  elsif ycols.nil? and ncols.nil?
@@ -48,7 +47,6 @@ module RIO
48
47
  ycols = [(0..-1)] if ycols.nil? or ycols.empty?
49
48
  ncols = Arraynge.ml_arraynge(num_cols,ncols)
50
49
  ycols = Arraynge.ml_arraynge(num_cols,ycols)
51
- #p "ccf: ncols=#{ncols.inspect} ycols=#{ycols.inspect}"
52
50
  cx['csv_columns'] = Arraynge.ml_diff(ycols,ncols)
53
51
  end
54
52
  end
@@ -65,7 +63,6 @@ module RIO
65
63
  ycols = [(0..-1)] if ycols.nil? or ycols.empty?
66
64
  ncols = Arraynge.ml_arraynge(num_cols,ncols)
67
65
  ycols = Arraynge.ml_arraynge(num_cols,ycols)
68
- #p "ccc: ncols=#{ncols.inspect} ycols=#{ycols.inspect}"
69
66
  cx['csv_columns'] = Arraynge.ml_diff(ycols,ncols)
70
67
  end
71
68
  end
@@ -81,21 +78,9 @@ module RIO
81
78
  end
82
79
  end
83
80
  def _trim_row(row)
84
- #p "ncols=#{cx['nocol_args'].inspect} ycols=#{cx['col_args'].inspect}"
85
- # unless cx['fields_args'].nil?
86
- # ftc = _fields_to_columns(row,cx['fields_args'])
87
- # p "ftc=#{ftc.inspect}"
88
- # unless ftc.empty?
89
- # cx['csv_columns'] ||= []
90
- # cx['csv_columns'] += ftc
91
- # end
92
- # end
93
- # p "csv_columns=#{cx['csv_columns'].inspect}"
94
-
95
81
  _calc_csv_fields(row)
96
82
  return row if cx['csv_columns'].nil?
97
83
 
98
- #cols = _trim_col(row.size-1,cx['csv_columns'])
99
84
  cols = cx['csv_columns']
100
85
  case row
101
86
  when ::CSV::Row
@@ -132,9 +117,7 @@ module RIO
132
117
 
133
118
 
134
119
  def each_line(*args,&block)
135
- # p self
136
120
  while raw_rec = self.shift()
137
- # p "RAW_REC=#{raw_rec}"
138
121
  case cx['stream_itertype']
139
122
  when 'lines'
140
123
  yield _trim(raw_rec).to_csv(*cx['csv_args'])
@@ -175,7 +158,6 @@ module RIO
175
158
  end
176
159
  module Output
177
160
  def add_csv_filter
178
- #p "add_csv_filter(#{self.ioh.ios})"
179
161
  csvio = ::CSV.new(self.ioh.ios,*cx['csv_args'])
180
162
  self.ioh.ios = csvio
181
163
  end
@@ -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.