tb 0.9 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +13 -11
- data/lib/tb.rb +14 -6
- data/lib/tb/catreader.rb +2 -2
- data/lib/tb/cmd_consecutive.rb +6 -2
- data/lib/tb/cmd_crop.rb +22 -3
- data/lib/tb/cmd_cross.rb +24 -0
- data/lib/tb/cmd_cut.rb +20 -10
- data/lib/tb/cmd_git.rb +20 -7
- data/lib/tb/cmd_group.rb +32 -0
- data/lib/tb/cmd_gsub.rb +21 -0
- data/lib/tb/cmd_join.rb +28 -0
- data/lib/tb/cmd_ls.rb +9 -0
- data/lib/tb/cmd_melt.rb +15 -0
- data/lib/tb/cmd_mheader.rb +15 -0
- data/lib/tb/cmd_nest.rb +27 -6
- data/lib/tb/cmd_newfield.rb +19 -2
- data/lib/tb/cmd_rename.rb +20 -0
- data/lib/tb/{cmd_grep.rb → cmd_search.rb} +37 -23
- data/lib/tb/cmd_shape.rb +69 -25
- data/lib/tb/cmd_sort.rb +20 -0
- data/lib/tb/cmd_tar.rb +38 -0
- data/lib/tb/cmd_to_json.rb +2 -2
- data/lib/tb/cmd_to_ltsv.rb +3 -3
- data/lib/tb/cmd_to_pnm.rb +3 -3
- data/lib/tb/cmd_to_tsv.rb +3 -3
- data/lib/tb/cmd_to_yaml.rb +3 -3
- data/lib/tb/cmd_unmelt.rb +15 -0
- data/lib/tb/cmd_unnest.rb +31 -7
- data/lib/tb/cmdmain.rb +2 -0
- data/lib/tb/cmdtop.rb +1 -1
- data/lib/tb/cmdutil.rb +9 -62
- data/lib/tb/csv.rb +21 -79
- data/lib/tb/enumerable.rb +42 -68
- data/lib/tb/enumerator.rb +15 -7
- data/lib/tb/{fieldset.rb → hashreader.rb} +37 -56
- data/lib/tb/hashwriter.rb +54 -0
- data/lib/tb/headerreader.rb +108 -0
- data/lib/tb/headerwriter.rb +116 -0
- data/lib/tb/json.rb +17 -15
- data/lib/tb/ltsv.rb +35 -96
- data/lib/tb/ndjson.rb +63 -0
- data/lib/tb/numericreader.rb +66 -0
- data/lib/tb/numericwriter.rb +61 -0
- data/lib/tb/pnm.rb +206 -200
- data/lib/tb/ropen.rb +54 -59
- data/lib/tb/tsv.rb +39 -71
- data/sample/excel2csv +24 -25
- data/sample/poi-xls2csv.rb +13 -14
- data/tb.gemspec +154 -0
- data/test/test_cmd_cat.rb +28 -6
- data/test/test_cmd_consecutive.rb +8 -3
- data/test/test_cmd_cut.rb +14 -4
- data/test/test_cmd_git_log.rb +50 -50
- data/test/test_cmd_grep.rb +6 -6
- data/test/test_cmd_gsub.rb +7 -2
- data/test/test_cmd_ls.rb +70 -62
- data/test/test_cmd_shape.rb +43 -6
- data/test/test_cmd_svn_log.rb +26 -27
- data/test/test_cmd_to_csv.rb +10 -5
- data/test/test_cmd_to_json.rb +16 -0
- data/test/test_cmd_to_ltsv.rb +2 -2
- data/test/test_cmd_to_pp.rb +7 -2
- data/test/test_csv.rb +74 -62
- data/test/test_ex_enumerable.rb +0 -1
- data/test/test_fileenumerator.rb +3 -3
- data/test/test_headercsv.rb +43 -0
- data/test/test_json.rb +2 -2
- data/test/test_ltsv.rb +22 -17
- data/test/test_ndjson.rb +62 -0
- data/test/test_numericcsv.rb +36 -0
- data/test/test_pnm.rb +69 -70
- data/test/test_reader.rb +27 -124
- data/test/test_tbenum.rb +18 -18
- data/test/test_tsv.rb +21 -32
- data/test/util_tbtest.rb +12 -0
- metadata +41 -19
- data/lib/tb/basic.rb +0 -1070
- data/lib/tb/reader.rb +0 -106
- data/lib/tb/record.rb +0 -158
- data/test/test_basic.rb +0 -403
- data/test/test_fieldset.rb +0 -42
- data/test/test_record.rb +0 -61
data/test/test_cmd_shape.rb
CHANGED
@@ -15,7 +15,44 @@ class TestTbCmdShape < Test::Unit::TestCase
|
|
15
15
|
FileUtils.rmtree @tmpdir
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_ndjson
|
19
|
+
File.open(i="i.ndjson", "w") {|f| f << <<-"End".gsub(/^[ \t]+/, '') }
|
20
|
+
{"a":0, "b":1}
|
21
|
+
{"a":4, "b":5, "c":6}
|
22
|
+
End
|
23
|
+
Tb::Cmd.main_shape(['-o', o="o.csv", i])
|
24
|
+
assert_equal(<<-"End".gsub(/^[ \t]+/, ''), File.read(o))
|
25
|
+
filename,records,min_pairs,max_pairs
|
26
|
+
i.ndjson,2,2,3
|
27
|
+
End
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_csv
|
31
|
+
File.open(i="i.csv", "w") {|f| f << <<-"End".gsub(/^[ \t]+/, '') }
|
32
|
+
a,b,c
|
33
|
+
0,1
|
34
|
+
4,5,6
|
35
|
+
End
|
36
|
+
Tb::Cmd.main_shape(['-o', o="o.csv", i])
|
37
|
+
assert_equal(<<-"End".gsub(/^[ \t]+/, ''), File.read(o))
|
38
|
+
filename,records,min_pairs,max_pairs,header_fields,min_fields,max_fields
|
39
|
+
i.csv,2,2,3,3,2,3
|
40
|
+
End
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_output_ndjson
|
44
|
+
File.open(i="i.csv", "w") {|f| f << <<-"End".gsub(/^[ \t]+/, '') }
|
45
|
+
a,b,c
|
46
|
+
0,1
|
47
|
+
4,5,6
|
48
|
+
End
|
49
|
+
Tb::Cmd.main_shape(['-o', o="o.ndjson", i])
|
50
|
+
assert_equal(<<-"End".gsub(/^[ \t]+/, ''), File.read(o))
|
51
|
+
{"filename":"i.csv","records":2,"min_pairs":2,"max_pairs":3,"header_fields":3,"min_fields":2,"max_fields":3}
|
52
|
+
End
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_extra_field
|
19
56
|
File.open(i="i.csv", "w") {|f| f << <<-"End".gsub(/^[ \t]+/, '') }
|
20
57
|
a,b,c
|
21
58
|
0,1
|
@@ -23,8 +60,8 @@ class TestTbCmdShape < Test::Unit::TestCase
|
|
23
60
|
End
|
24
61
|
Tb::Cmd.main_shape(['-o', o="o.csv", i])
|
25
62
|
assert_equal(<<-"End".gsub(/^[ \t]+/, ''), File.read(o))
|
26
|
-
header_fields,min_fields,max_fields
|
27
|
-
|
63
|
+
filename,records,min_pairs,max_pairs,header_fields,min_fields,max_fields
|
64
|
+
i.csv,2,2,3,3,2,4
|
28
65
|
End
|
29
66
|
end
|
30
67
|
|
@@ -41,9 +78,9 @@ class TestTbCmdShape < Test::Unit::TestCase
|
|
41
78
|
End
|
42
79
|
Tb::Cmd.main_shape(['-o', o="o.csv", i1, i2])
|
43
80
|
assert_equal(<<-"End".gsub(/^[ \t]+/, ''), File.read(o))
|
44
|
-
header_fields,min_fields,max_fields
|
45
|
-
1,1,1,
|
46
|
-
2,2,2,2,
|
81
|
+
filename,records,min_pairs,max_pairs,header_fields,min_fields,max_fields
|
82
|
+
i1.csv,2,1,1,1,1,1
|
83
|
+
i2.csv,2,2,2,2,2,2
|
47
84
|
End
|
48
85
|
end
|
49
86
|
|
data/test/test_cmd_svn_log.rb
CHANGED
@@ -34,10 +34,10 @@ class TestTbCmdSvnLog < Test::Unit::TestCase
|
|
34
34
|
system("svn commit -q -m baz foo hoge")
|
35
35
|
system("svn update -q") # update the revision of the directory.
|
36
36
|
Tb::Cmd.main_svn(['-o', o="o.csv"])
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
assert_match(/baz/,
|
37
|
+
aa = CSV.read(o)
|
38
|
+
assert_equal(2, aa.length)
|
39
|
+
header, row = aa
|
40
|
+
assert_match(/baz/, row[header.index "msg"])
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_verbose
|
@@ -49,16 +49,15 @@ class TestTbCmdSvnLog < Test::Unit::TestCase
|
|
49
49
|
system("svn commit -q -m baz foo hoge")
|
50
50
|
system("svn update -q") # update the revision of the directory.
|
51
51
|
Tb::Cmd.main_svn(['-o', o="o.csv", '--', '-v'])
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
assert_match(/baz/, rec["msg"])
|
52
|
+
aa = CSV.read(o)
|
53
|
+
assert_equal(3, aa.length)
|
54
|
+
header, *rows = aa
|
55
|
+
rows = rows.sort_by {|rec| rows[header.index 'path'] }
|
56
|
+
rows.each {|row|
|
57
|
+
assert_match(/baz/, row[header.index "msg"])
|
59
58
|
}
|
60
|
-
assert_match(/foo/,
|
61
|
-
assert_match(/hoge/,
|
59
|
+
assert_match(/foo/, rows[0][header.index "path"])
|
60
|
+
assert_match(/hoge/, rows[1][header.index "path"])
|
62
61
|
end
|
63
62
|
|
64
63
|
def test_log_xml
|
@@ -71,18 +70,18 @@ class TestTbCmdSvnLog < Test::Unit::TestCase
|
|
71
70
|
system("svn update -q") # update the revision of the directory.
|
72
71
|
###
|
73
72
|
Tb::Cmd.main_svn(['-o', o="o.csv"])
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
assert_match(/baz/,
|
73
|
+
aa = CSV.read(o)
|
74
|
+
assert_equal(2, aa.length)
|
75
|
+
header, row = aa
|
76
|
+
assert_match(/baz/, row[header.index "msg"])
|
78
77
|
###
|
79
78
|
system("svn log --xml > log.xml")
|
80
79
|
FileUtils.rmtree('.svn')
|
81
80
|
Tb::Cmd.main_svn(['-o', o="o.csv", '--svn-log-xml=log.xml'])
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
assert_match(/baz/,
|
81
|
+
aa = CSV.read(o)
|
82
|
+
assert_equal(2, aa.length)
|
83
|
+
header, row = aa
|
84
|
+
assert_match(/baz/, row[header.index "msg"])
|
86
85
|
end
|
87
86
|
|
88
87
|
def test_no_props
|
@@ -98,11 +97,11 @@ class TestTbCmdSvnLog < Test::Unit::TestCase
|
|
98
97
|
system("svn propdel -q svn:log --revprop -r 1 .")
|
99
98
|
###
|
100
99
|
Tb::Cmd.main_svn(['-o', o="o.csv"])
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
assert_equal('(no author)',
|
105
|
-
assert_equal('(no date)',
|
106
|
-
assert_equal('',
|
100
|
+
aa = CSV.read(o)
|
101
|
+
assert_equal(2, aa.length)
|
102
|
+
header, row = aa
|
103
|
+
assert_equal('(no author)', row[header.index "author"])
|
104
|
+
assert_equal('(no date)', row[header.index "date"])
|
105
|
+
assert_equal('', row[header.index "msg"])
|
107
106
|
end
|
108
107
|
end
|
data/test/test_cmd_to_csv.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'tb/cmdtop'
|
3
3
|
require 'tmpdir'
|
4
|
+
require_relative 'util_tbtest'
|
4
5
|
|
5
6
|
class TestTbCmdToCSV < Test::Unit::TestCase
|
6
7
|
def setup
|
@@ -49,18 +50,22 @@ class TestTbCmdToCSV < Test::Unit::TestCase
|
|
49
50
|
End
|
50
51
|
end
|
51
52
|
|
52
|
-
def
|
53
|
+
def test_short_header
|
53
54
|
File.open(i="i.csv", "w") {|f| f << <<-"End".gsub(/^[ \t]+/, '') }
|
54
55
|
a,b
|
55
56
|
0,1,2
|
56
57
|
4,5,6
|
57
58
|
End
|
58
|
-
|
59
|
+
o = "o.csv"
|
60
|
+
stderr = capture_stderr {
|
61
|
+
Tb::Cmd.main_to_csv(['-o', o, i])
|
62
|
+
}
|
59
63
|
assert_equal(<<-"End".gsub(/^[ \t]+/, ''), File.read(o))
|
60
|
-
a,b
|
61
|
-
0,1
|
62
|
-
4,5
|
64
|
+
a,b
|
65
|
+
0,1
|
66
|
+
4,5
|
63
67
|
End
|
68
|
+
assert_match(/Header too short/, stderr)
|
64
69
|
end
|
65
70
|
|
66
71
|
def test_numeric
|
data/test/test_cmd_to_json.rb
CHANGED
@@ -68,6 +68,22 @@ class TestTbCmdToJSON < Test::Unit::TestCase
|
|
68
68
|
End
|
69
69
|
end
|
70
70
|
|
71
|
+
def test_ltsv_to_json1
|
72
|
+
File.open(i="i.ltsv", "w") {|f| f << "foo:bar\n" }
|
73
|
+
Tb::Cmd.main_to_json(['-o', o="o.json", i])
|
74
|
+
assert_equal(<<-"End".gsub(/\s/, ''), File.read(o).gsub(/\s/, ''))
|
75
|
+
[{"foo":"bar"}]
|
76
|
+
End
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_ltsv_to_json2
|
80
|
+
File.open(i="i.ltsv", "w") {|f| f << "foo:bar\nbaz:qux\n" }
|
81
|
+
Tb::Cmd.main_to_json(['-o', o="o.json", i])
|
82
|
+
assert_equal(<<-"End".gsub(/\s/, ''), File.read(o).gsub(/\s/, ''))
|
83
|
+
[{"foo":"bar"}, {"baz":"qux"}]
|
84
|
+
End
|
85
|
+
end
|
86
|
+
|
71
87
|
def test_twofile
|
72
88
|
File.open(i1="i1.csv", "w") {|f| f << <<-"End".gsub(/^[ \t]+/, '') }
|
73
89
|
a,b
|
data/test/test_cmd_to_ltsv.rb
CHANGED
data/test/test_cmd_to_pp.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'tb/cmdtop'
|
3
3
|
require 'tmpdir'
|
4
|
+
require_relative 'util_tbtest'
|
4
5
|
|
5
6
|
class TestTbCmdToPP < Test::Unit::TestCase
|
6
7
|
def setup
|
@@ -33,10 +34,14 @@ class TestTbCmdToPP < Test::Unit::TestCase
|
|
33
34
|
a,b
|
34
35
|
0,1,2,3
|
35
36
|
End
|
36
|
-
|
37
|
+
o = "o.pp"
|
38
|
+
stderr = capture_stderr {
|
39
|
+
Tb::Cmd.main_to_pp(['-o', o, i])
|
40
|
+
}
|
37
41
|
assert_equal(<<-"End".gsub(/\s/, ''), File.read(o).gsub(/\s/, ''))
|
38
|
-
{ "a" => "0", "b" => "1"
|
42
|
+
{ "a" => "0", "b" => "1" }
|
39
43
|
End
|
44
|
+
assert_match(/Header too short/, stderr)
|
40
45
|
end
|
41
46
|
|
42
47
|
def test_twofile
|
data/test/test_csv.rb
CHANGED
@@ -1,98 +1,110 @@
|
|
1
1
|
require 'tb'
|
2
2
|
require 'test/unit'
|
3
|
+
require_relative 'util_tbtest'
|
3
4
|
|
4
5
|
class TestTbCSV < Test::Unit::TestCase
|
6
|
+
def parse_csv(csv)
|
7
|
+
Tb::HeaderCSVReader.new(StringIO.new(csv)).to_a
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate_csv(ary)
|
11
|
+
writer = Tb::HeaderCSVWriter.new(out = '')
|
12
|
+
ary.each {|h| writer.put_hash h }
|
13
|
+
writer.finish
|
14
|
+
out
|
15
|
+
end
|
16
|
+
|
5
17
|
def test_parse
|
6
|
-
|
18
|
+
t = parse_csv(<<-'End'.gsub(/^\s+/, ''))
|
19
|
+
a,b
|
20
|
+
1,2
|
21
|
+
3,4
|
22
|
+
End
|
23
|
+
assert_equal(
|
24
|
+
[{"a"=>"1", "b"=>"2"},
|
25
|
+
{"a"=>"3", "b"=>"4"}],
|
26
|
+
t)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_parse_empty_line_before_header
|
30
|
+
empty_line = "\n"
|
31
|
+
t = parse_csv(empty_line + <<-'End'.gsub(/^\s+/, ''))
|
7
32
|
a,b
|
8
33
|
1,2
|
9
34
|
3,4
|
10
35
|
End
|
11
|
-
t = Tb.parse_csv(csv)
|
12
|
-
records = []
|
13
|
-
t.each_record {|record|
|
14
|
-
records << record.to_h_with_reserved
|
15
|
-
}
|
16
36
|
assert_equal(
|
17
|
-
[{"
|
18
|
-
{"
|
19
|
-
|
37
|
+
[{"a"=>"1", "b"=>"2"},
|
38
|
+
{"a"=>"3", "b"=>"4"}],
|
39
|
+
t)
|
20
40
|
end
|
21
41
|
|
22
|
-
def
|
23
|
-
|
42
|
+
def test_parse_empty_value
|
43
|
+
t = parse_csv(<<-'End'.gsub(/^\s+/, ''))
|
24
44
|
a,b,c
|
25
45
|
1,,2
|
26
46
|
3,"",4
|
27
47
|
End
|
28
|
-
t = Tb.parse_csv(csv)
|
29
|
-
records = []
|
30
|
-
t.each_record {|record|
|
31
|
-
records << record.to_h_with_reserved
|
32
|
-
}
|
33
48
|
assert_equal(
|
34
|
-
[{"
|
35
|
-
{"
|
36
|
-
|
49
|
+
[{"a"=>"1", "b"=>nil, "c"=>"2"},
|
50
|
+
{"a"=>"3", "b"=>"", "c"=>"4"}],
|
51
|
+
t)
|
37
52
|
end
|
38
53
|
|
39
|
-
def
|
40
|
-
|
41
|
-
t
|
42
|
-
assert_equal([%w[foo],
|
43
|
-
%w[a b],
|
44
|
-
%w[1 2]],
|
45
|
-
aa)
|
46
|
-
aa.shift
|
47
|
-
aa
|
48
|
-
}
|
49
|
-
records = []
|
50
|
-
t.each_record {|record|
|
51
|
-
records << record.to_h_with_reserved
|
52
|
-
}
|
53
|
-
assert_equal(
|
54
|
-
[{"_recordid"=>0, "a"=>"1", "b"=>"2"}],
|
55
|
-
records)
|
54
|
+
def test_parse_newline
|
55
|
+
t = parse_csv("\n")
|
56
|
+
assert_equal([], t)
|
56
57
|
end
|
57
58
|
|
58
59
|
def test_generate
|
59
|
-
t =
|
60
|
-
|
61
|
-
assert_equal(<<-'End'.gsub(/^\s+/, ''),
|
60
|
+
t = [{'a' => 1, 'b' => 2},
|
61
|
+
{'a' => 3, 'b' => 4}]
|
62
|
+
assert_equal(<<-'End'.gsub(/^\s+/, ''), generate_csv(t))
|
62
63
|
a,b
|
63
64
|
1,2
|
64
65
|
3,4
|
65
66
|
End
|
66
67
|
end
|
67
68
|
|
68
|
-
def test_generate_without_explicit_fields
|
69
|
-
t = Tb.new %w[a b], [1, 2], [3, 4]
|
70
|
-
out = t.generate_csv('')
|
71
|
-
assert_equal(<<-'End'.gsub(/^\s+/, ''), out)
|
72
|
-
a,b
|
73
|
-
1,2
|
74
|
-
3,4
|
75
|
-
End
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_generate_with_block
|
79
|
-
t = Tb.new %w[a b], [1, 2], [3, 4]
|
80
|
-
out = t.generate_csv('', ['a', 'b']) {|recids| recids.reverse }
|
81
|
-
assert_equal(<<-'End'.gsub(/^\s+/, ''), out)
|
82
|
-
a,b
|
83
|
-
3,4
|
84
|
-
1,2
|
85
|
-
End
|
86
|
-
end
|
87
|
-
|
88
69
|
def test_generate_empty
|
89
|
-
t =
|
90
|
-
|
91
|
-
assert_equal(<<-'End'.gsub(/^\s+/, ''),
|
70
|
+
t = [{'a' => 1, 'b' => nil, 'c' => 2},
|
71
|
+
{'a' => 3, 'b' => '', 'c' => 4}]
|
72
|
+
assert_equal(<<-'End'.gsub(/^\s+/, ''), generate_csv(t))
|
92
73
|
a,b,c
|
93
74
|
1,,2
|
94
75
|
3,"",4
|
95
76
|
End
|
96
77
|
end
|
97
78
|
|
79
|
+
def test_parse_ambiguous_header
|
80
|
+
t = nil
|
81
|
+
stderr = capture_stderr {
|
82
|
+
t = parse_csv(<<-'End'.gsub(/^\s+/, ''))
|
83
|
+
a,b,a,b,c
|
84
|
+
0,1,2,3,4
|
85
|
+
5,6,7,8,9
|
86
|
+
End
|
87
|
+
}
|
88
|
+
assert_equal(
|
89
|
+
[{"a"=>"0", "b"=>"1", "c"=>"4"},
|
90
|
+
{"a"=>"5", "b"=>"6", "c"=>"9"}],
|
91
|
+
t)
|
92
|
+
assert_match(/Ambiguous header field/, stderr)
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_parse_empty_header_field
|
96
|
+
t = nil
|
97
|
+
stderr = capture_stderr {
|
98
|
+
t = parse_csv(<<-'End'.gsub(/^\s+/, ''))
|
99
|
+
a,,c
|
100
|
+
0,1,2
|
101
|
+
5,6,7
|
102
|
+
End
|
103
|
+
}
|
104
|
+
assert_equal(
|
105
|
+
[{"a"=>"0", "c"=>"2"},
|
106
|
+
{"a"=>"5", "c"=>"7"}],
|
107
|
+
t)
|
108
|
+
assert_match(/Empty header field/, stderr)
|
109
|
+
end
|
98
110
|
end
|
data/test/test_ex_enumerable.rb
CHANGED
@@ -46,7 +46,6 @@ class TestTbEnumerable < Test::Unit::TestCase
|
|
46
46
|
a.tb_categorize(:color, lambda {|e| true }, :seed=>0, :op=>lambda {|s, v| s+1 }))
|
47
47
|
|
48
48
|
assert_raise(ArgumentError) { a.tb_categorize(:color, lambda {|e| true }, :seed=>0,
|
49
|
-
:seed=>nil,
|
50
49
|
:op=>lambda {|s, v| s+1 },
|
51
50
|
:update=>lambda {|ks, s, v| s+1 }) }
|
52
51
|
|
data/test/test_fileenumerator.rb
CHANGED
@@ -204,7 +204,7 @@ class TestTbFileEnumerator < Test::Unit::TestCase
|
|
204
204
|
end
|
205
205
|
|
206
206
|
def test_to_fileheaderenumerator_reader
|
207
|
-
tb = Tb.
|
207
|
+
tb = Tb::Enumerator.from_header_and_values %w[a b], [1, 2], [3, 4]
|
208
208
|
fe = tb.to_fileenumerator
|
209
209
|
iter = fe.each
|
210
210
|
assert_respond_to(iter, :next)
|
@@ -222,7 +222,7 @@ class TestTbFileEnumerator < Test::Unit::TestCase
|
|
222
222
|
end
|
223
223
|
|
224
224
|
def test_to_fileheaderenumerator_with_header_reader
|
225
|
-
tb = Tb.
|
225
|
+
tb = Tb::Enumerator.from_header_and_values %w[a b], [1, 2], [3, 4]
|
226
226
|
header = nil
|
227
227
|
fe = tb.with_header {|h0|
|
228
228
|
header = h0
|
@@ -244,7 +244,7 @@ class TestTbFileEnumerator < Test::Unit::TestCase
|
|
244
244
|
end
|
245
245
|
|
246
246
|
def test_fileheaderenumerator_open_reader
|
247
|
-
tb = Tb.
|
247
|
+
tb = Tb::Enumerator.from_header_and_values %w[a b], [1, 2], [3, 4]
|
248
248
|
fe = tb.to_fileenumerator
|
249
249
|
iter0 = nil
|
250
250
|
fe.open_reader {|iter|
|