dsv 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +9 -0
- data/README.md +1 -1
- data/TODO +28 -32
- data/lib/DSV/VERSION.rb +1 -1
- data/lib/dsv.rb +1 -0
- data/test/dsv_test.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68ee37a3368b46ed10b4db2e410f307bd8dfa91a3cb4d6a4efc09cdd7d9f145d
|
|
4
|
+
data.tar.gz: 603055fe7b22a34c27afa5a21f68cbfef07c547620098cc6337e391e4254aecc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b31f1db141bbe95eee0c037db6ccf2c9e9c9c0d9384a089e9629567f53349a939d73ca46802b0fe9cfed8dc47207be8c31da88ce92a5ba9c6e034b85e905e5b
|
|
7
|
+
data.tar.gz: b53b03fcce52c0ae7e42255908e1ac998df4afb1412909857833f0925506efe7553c0f6ed4cea03794cc502a96449c3bf62c8dd038dbe16667e6124324401aa9
|
data/CHANGELOG
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## 20261126
|
|
4
4
|
|
|
5
|
+
0.16.0: + DSV.filter: An alias of DSV.select.
|
|
6
|
+
|
|
7
|
+
1. + DSV.filter: An alias of select, as find_all is.
|
|
8
|
+
2. ~ test/dsv_test.rb: Selecting by filter is tested, beside select and find_all.
|
|
9
|
+
3. ~ README.md: The class-level aliases include filter.
|
|
10
|
+
4. ~ TODO: The job for filter is gone, and the rest are numbered from 1.
|
|
11
|
+
5. ~ ROADMAP.md: 0.16.0 is gone.
|
|
12
|
+
6. ~ DSV::VERSION: /0.15.0/0.16.0/
|
|
13
|
+
|
|
5
14
|
0.15.0: ~ DSV#read: Under :single, every field is read as single-quoted.
|
|
6
15
|
|
|
7
16
|
1. ~ split_row(): Under :single, :single_quoted and :single_quotes, every field is read as single-quoted, and a row with a field which isn't raises UnquotedField. They had been read as unspecified.
|
data/README.md
CHANGED
|
@@ -73,7 +73,7 @@ DSV.detect('people.csv', headers: true){|row| row['name'] == 'Ada'}
|
|
|
73
73
|
DSV.collect('people.csv', headers: true){|row| row['name'].upcase}
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
`foreach`, `map`, `find_all` and `find` are aliases. Each closes the file it opens. Without a block, each returns an Enumerator, which opens the file again on each pass, so `DSV.each('people.csv', headers: true).each_slice(100)` works as it would on any Enumerable.
|
|
76
|
+
`foreach`, `map`, `find_all`, `filter` and `find` are aliases. Each closes the file it opens. Without a block, each returns an Enumerator, which opens the file again on each pass, so `DSV.each('people.csv', headers: true).each_slice(100)` works as it would on any Enumerable.
|
|
77
77
|
|
|
78
78
|
### Any delimiter
|
|
79
79
|
|
data/TODO
CHANGED
|
@@ -1,48 +1,44 @@
|
|
|
1
1
|
# TODO
|
|
2
2
|
|
|
3
|
-
## `filter`
|
|
4
|
-
|
|
5
|
-
1. filter, a class-level alias of select.
|
|
6
|
-
|
|
7
3
|
## Modes as declarations
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
1. An unknown quote mode, file mode or option raises ArgumentError.
|
|
6
|
+
2. :unspecified, the name of the default.
|
|
7
|
+
3. :unquoted, the name of the mode reading no quotes, :none kept as an alias.
|
|
8
|
+
4. The reader chosen once, when the quote mode is set, as row_renderer is for writing.
|
|
9
|
+
5. .read and .open taking a path, and .parse text; a path which does not exist raising, and nothing inferred from whether a file exists.
|
|
10
|
+
6. attributes= setting columns, attributes always worked out from columns; rows read afterwards keyed by those names.
|
|
15
11
|
|
|
16
12
|
## Streaming
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
7. each yields each row as it is read.
|
|
15
|
+
8. each returns its receiver.
|
|
16
|
+
9. rows no longer filled by each.
|
|
17
|
+
10. Chunks from each_slice.
|
|
18
|
+
11. The source read once, start to end, with no rewind; the header from the first row read.
|
|
19
|
+
12. The line of an error found by seeking only where the source can.
|
|
20
|
+
13. A rewind left to r+ rewriting and to first_row called alone.
|
|
25
21
|
|
|
26
22
|
## Checked and measured
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
14. A corpus in the tests, a day of NEMWEB's dispatch files, trimmed, and the RFC 4180 cases, each checked against stdlib CSV's rows.
|
|
25
|
+
15. A benchmark script against stdlib CSV, and the README's speed sentence written from its output.
|
|
26
|
+
16. The README showing every mode by example, and a table matching each to stdlib CSV's and Python's settings.
|
|
31
27
|
|
|
32
28
|
## Speed, results unchanged
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
17. A per-row fast path for the default: split, the fields bare or wrapped in two quotes unwrapped, any other row read in full.
|
|
31
|
+
18. as_array: returning the split fields, rather than building a Hash and then an Array from it.
|
|
32
|
+
19. Rows built by zip.to_h.
|
|
33
|
+
20. The scanner-based parser, at the tag scanner-parser-20261006, judged against the string operations used now.
|
|
38
34
|
|
|
39
35
|
## Features
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
21. :rfc_4180, a quote mode reading what RFC 4180 allows as :unspecified does and raising on what it forbids.
|
|
38
|
+
22. field_count:, :header or an Integer, off by default; a row of another width raising.
|
|
39
|
+
23. Writing with minimal quoting: a field quoted only where it holds a separator, a quote or a row terminator.
|
|
40
|
+
24. A line number in each parse error, and line_numbers:.
|
|
41
|
+
25. headers?, the instance-level header_row renamed, header_row kept as an alias.
|
|
42
|
+
26. <<, to append a row, and generate, to build a string.
|
|
43
|
+
27. Symbols and Strings interchangeable for column names, in a selection, a columns: list and a row's keys.
|
|
44
|
+
28. Duplicate headers by option: all kept as an Array, the default; indexed, a, a.1; first; last; error.
|
data/lib/DSV/VERSION.rb
CHANGED
data/lib/dsv.rb
CHANGED
data/test/dsv_test.rb
CHANGED
|
@@ -163,9 +163,10 @@ describe DSV do
|
|
|
163
163
|
_(DSV.map(DATA, headers: true){|row| row['a'].to_i}).must_equal [1, 4]
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
-
it "selects the rows for which the block is true, also as find_all" do
|
|
166
|
+
it "selects the rows for which the block is true, also as find_all and filter" do
|
|
167
167
|
_(DSV.select(DATA, headers: true){|row| row['a'] == '4'}).must_equal [KEYED.last]
|
|
168
168
|
_(DSV.find_all(DATA, headers: true){|row| row['a'] == '4'}).must_equal [KEYED.last]
|
|
169
|
+
_(DSV.filter(DATA, headers: true){|row| row['a'] == '4'}).must_equal [KEYED.last]
|
|
169
170
|
end
|
|
170
171
|
|
|
171
172
|
it "rejects the rows for which the block is true" do
|