rubysl-csv 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE +25 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/lib/csv.rb +1 -0
- data/lib/rubysl/csv.rb +2 -0
- data/lib/rubysl/csv/csv.rb +992 -0
- data/lib/rubysl/csv/version.rb +5 -0
- data/rubysl-csv.gemspec +27 -0
- data/spec/basicwriter/close_on_terminate_spec.rb +5 -0
- data/spec/basicwriter/initialize_spec.rb +5 -0
- data/spec/basicwriter/terminate_spec.rb +5 -0
- data/spec/cell/data_spec.rb +5 -0
- data/spec/cell/initialize_spec.rb +5 -0
- data/spec/fixtures/one_line.csv +1 -0
- data/spec/foreach_spec.rb +5 -0
- data/spec/generate_line_spec.rb +58 -0
- data/spec/generate_row_spec.rb +5 -0
- data/spec/generate_spec.rb +73 -0
- data/spec/iobuf/close_spec.rb +5 -0
- data/spec/iobuf/initialize_spec.rb +5 -0
- data/spec/iobuf/read_spec.rb +5 -0
- data/spec/iobuf/terminate_spec.rb +5 -0
- data/spec/ioreader/close_on_terminate_spec.rb +5 -0
- data/spec/ioreader/get_row_spec.rb +5 -0
- data/spec/ioreader/initialize_spec.rb +5 -0
- data/spec/ioreader/terminate_spec.rb +5 -0
- data/spec/open_spec.rb +5 -0
- data/spec/parse_row_spec.rb +29 -0
- data/spec/parse_spec.rb +126 -0
- data/spec/read_spec.rb +5 -0
- data/spec/reader/close_spec.rb +7 -0
- data/spec/reader/create_spec.rb +7 -0
- data/spec/reader/each_spec.rb +7 -0
- data/spec/reader/get_row_spec.rb +7 -0
- data/spec/reader/initialize_spec.rb +7 -0
- data/spec/reader/parse_spec.rb +24 -0
- data/spec/reader/shift_spec.rb +7 -0
- data/spec/reader/terminate_spec.rb +7 -0
- data/spec/readlines_spec.rb +24 -0
- data/spec/streambuf/add_buf_spec.rb +5 -0
- data/spec/streambuf/buf_size_spec.rb +5 -0
- data/spec/streambuf/drop_spec.rb +5 -0
- data/spec/streambuf/element_reference_spec.rb +5 -0
- data/spec/streambuf/get_spec.rb +5 -0
- data/spec/streambuf/idx_is_eos_spec.rb +5 -0
- data/spec/streambuf/initialize_spec.rb +5 -0
- data/spec/streambuf/is_eos_spec.rb +5 -0
- data/spec/streambuf/read_spec.rb +5 -0
- data/spec/streambuf/rel_buf_spec.rb +5 -0
- data/spec/streambuf/terminate_spec.rb +5 -0
- data/spec/stringreader/get_row_spec.rb +5 -0
- data/spec/stringreader/initialize_spec.rb +5 -0
- data/spec/writer/add_row_spec.rb +5 -0
- data/spec/writer/append_spec.rb +5 -0
- data/spec/writer/close_spec.rb +5 -0
- data/spec/writer/create_spec.rb +5 -0
- data/spec/writer/generate_spec.rb +5 -0
- data/spec/writer/initialize_spec.rb +5 -0
- data/spec/writer/terminate_spec.rb +5 -0
- metadata +227 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
ruby_version_is "" ... "1.9" do
|
4
|
+
describe "CSV::Reader.parse" do
|
5
|
+
|
6
|
+
it "processes empty input without calling block" do
|
7
|
+
empty_input = mock('empty file')
|
8
|
+
empty_input.should_receive(:read).once.and_return(nil)
|
9
|
+
CSV::Reader.parse(empty_input) do |row|
|
10
|
+
Expectation.fail_with('block should not be executed', 'but executed')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it "calls block once for one row of input" do
|
15
|
+
input_stream = File.open(File.dirname(__FILE__) + '/../fixtures/one_line.csv', 'rb')
|
16
|
+
count = 0
|
17
|
+
CSV::Reader.parse(input_stream) do |row|
|
18
|
+
count += 1
|
19
|
+
end
|
20
|
+
count.should == 1
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
describe "CSV.readlines" do
|
4
|
+
it "needs to be reviewed for spec completeness"
|
5
|
+
end
|
6
|
+
|
7
|
+
ruby_version_is "1.9" do
|
8
|
+
describe "CSV#readlines" do
|
9
|
+
it "returns an Array of Array containing each element in a one-line CSV file" do
|
10
|
+
file = CSV.new "a, b, c"
|
11
|
+
file.readlines.should == [["a", " b", " c"]]
|
12
|
+
end
|
13
|
+
|
14
|
+
it "returns an Array of Arrays containing each element in a multi-line CSV file" do
|
15
|
+
file = CSV.new "a, b, c\nd, e, f"
|
16
|
+
file.readlines.should == [["a", " b", " c"], ["d", " e", " f"]]
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns nil for a missing value" do
|
20
|
+
file = CSV.new "a,, b, c"
|
21
|
+
file.readlines.should == [["a", nil, " b", " c"]]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,227 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubysl-csv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Shirai
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubysl-english
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubysl-prettyprint
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
description: Ruby standard library csv.
|
84
|
+
email:
|
85
|
+
- brixen@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .travis.yml
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- lib/csv.rb
|
97
|
+
- lib/rubysl/csv.rb
|
98
|
+
- lib/rubysl/csv/csv.rb
|
99
|
+
- lib/rubysl/csv/version.rb
|
100
|
+
- rubysl-csv.gemspec
|
101
|
+
- spec/basicwriter/close_on_terminate_spec.rb
|
102
|
+
- spec/basicwriter/initialize_spec.rb
|
103
|
+
- spec/basicwriter/terminate_spec.rb
|
104
|
+
- spec/cell/data_spec.rb
|
105
|
+
- spec/cell/initialize_spec.rb
|
106
|
+
- spec/fixtures/one_line.csv
|
107
|
+
- spec/foreach_spec.rb
|
108
|
+
- spec/generate_line_spec.rb
|
109
|
+
- spec/generate_row_spec.rb
|
110
|
+
- spec/generate_spec.rb
|
111
|
+
- spec/iobuf/close_spec.rb
|
112
|
+
- spec/iobuf/initialize_spec.rb
|
113
|
+
- spec/iobuf/read_spec.rb
|
114
|
+
- spec/iobuf/terminate_spec.rb
|
115
|
+
- spec/ioreader/close_on_terminate_spec.rb
|
116
|
+
- spec/ioreader/get_row_spec.rb
|
117
|
+
- spec/ioreader/initialize_spec.rb
|
118
|
+
- spec/ioreader/terminate_spec.rb
|
119
|
+
- spec/open_spec.rb
|
120
|
+
- spec/parse_row_spec.rb
|
121
|
+
- spec/parse_spec.rb
|
122
|
+
- spec/read_spec.rb
|
123
|
+
- spec/reader/close_spec.rb
|
124
|
+
- spec/reader/create_spec.rb
|
125
|
+
- spec/reader/each_spec.rb
|
126
|
+
- spec/reader/get_row_spec.rb
|
127
|
+
- spec/reader/initialize_spec.rb
|
128
|
+
- spec/reader/parse_spec.rb
|
129
|
+
- spec/reader/shift_spec.rb
|
130
|
+
- spec/reader/terminate_spec.rb
|
131
|
+
- spec/readlines_spec.rb
|
132
|
+
- spec/streambuf/add_buf_spec.rb
|
133
|
+
- spec/streambuf/buf_size_spec.rb
|
134
|
+
- spec/streambuf/drop_spec.rb
|
135
|
+
- spec/streambuf/element_reference_spec.rb
|
136
|
+
- spec/streambuf/get_spec.rb
|
137
|
+
- spec/streambuf/idx_is_eos_spec.rb
|
138
|
+
- spec/streambuf/initialize_spec.rb
|
139
|
+
- spec/streambuf/is_eos_spec.rb
|
140
|
+
- spec/streambuf/read_spec.rb
|
141
|
+
- spec/streambuf/rel_buf_spec.rb
|
142
|
+
- spec/streambuf/terminate_spec.rb
|
143
|
+
- spec/stringreader/get_row_spec.rb
|
144
|
+
- spec/stringreader/initialize_spec.rb
|
145
|
+
- spec/writer/add_row_spec.rb
|
146
|
+
- spec/writer/append_spec.rb
|
147
|
+
- spec/writer/close_spec.rb
|
148
|
+
- spec/writer/create_spec.rb
|
149
|
+
- spec/writer/generate_spec.rb
|
150
|
+
- spec/writer/initialize_spec.rb
|
151
|
+
- spec/writer/terminate_spec.rb
|
152
|
+
homepage: https://github.com/rubysl/rubysl-csv
|
153
|
+
licenses:
|
154
|
+
- BSD
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ~>
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 1.8.7
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubyforge_project:
|
172
|
+
rubygems_version: 2.0.7
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: Ruby standard library csv.
|
176
|
+
test_files:
|
177
|
+
- spec/basicwriter/close_on_terminate_spec.rb
|
178
|
+
- spec/basicwriter/initialize_spec.rb
|
179
|
+
- spec/basicwriter/terminate_spec.rb
|
180
|
+
- spec/cell/data_spec.rb
|
181
|
+
- spec/cell/initialize_spec.rb
|
182
|
+
- spec/fixtures/one_line.csv
|
183
|
+
- spec/foreach_spec.rb
|
184
|
+
- spec/generate_line_spec.rb
|
185
|
+
- spec/generate_row_spec.rb
|
186
|
+
- spec/generate_spec.rb
|
187
|
+
- spec/iobuf/close_spec.rb
|
188
|
+
- spec/iobuf/initialize_spec.rb
|
189
|
+
- spec/iobuf/read_spec.rb
|
190
|
+
- spec/iobuf/terminate_spec.rb
|
191
|
+
- spec/ioreader/close_on_terminate_spec.rb
|
192
|
+
- spec/ioreader/get_row_spec.rb
|
193
|
+
- spec/ioreader/initialize_spec.rb
|
194
|
+
- spec/ioreader/terminate_spec.rb
|
195
|
+
- spec/open_spec.rb
|
196
|
+
- spec/parse_row_spec.rb
|
197
|
+
- spec/parse_spec.rb
|
198
|
+
- spec/read_spec.rb
|
199
|
+
- spec/reader/close_spec.rb
|
200
|
+
- spec/reader/create_spec.rb
|
201
|
+
- spec/reader/each_spec.rb
|
202
|
+
- spec/reader/get_row_spec.rb
|
203
|
+
- spec/reader/initialize_spec.rb
|
204
|
+
- spec/reader/parse_spec.rb
|
205
|
+
- spec/reader/shift_spec.rb
|
206
|
+
- spec/reader/terminate_spec.rb
|
207
|
+
- spec/readlines_spec.rb
|
208
|
+
- spec/streambuf/add_buf_spec.rb
|
209
|
+
- spec/streambuf/buf_size_spec.rb
|
210
|
+
- spec/streambuf/drop_spec.rb
|
211
|
+
- spec/streambuf/element_reference_spec.rb
|
212
|
+
- spec/streambuf/get_spec.rb
|
213
|
+
- spec/streambuf/idx_is_eos_spec.rb
|
214
|
+
- spec/streambuf/initialize_spec.rb
|
215
|
+
- spec/streambuf/is_eos_spec.rb
|
216
|
+
- spec/streambuf/read_spec.rb
|
217
|
+
- spec/streambuf/rel_buf_spec.rb
|
218
|
+
- spec/streambuf/terminate_spec.rb
|
219
|
+
- spec/stringreader/get_row_spec.rb
|
220
|
+
- spec/stringreader/initialize_spec.rb
|
221
|
+
- spec/writer/add_row_spec.rb
|
222
|
+
- spec/writer/append_spec.rb
|
223
|
+
- spec/writer/close_spec.rb
|
224
|
+
- spec/writer/create_spec.rb
|
225
|
+
- spec/writer/generate_spec.rb
|
226
|
+
- spec/writer/initialize_spec.rb
|
227
|
+
- spec/writer/terminate_spec.rb
|