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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4914f31a3cf3aa41ed6dd8ff27b3d8b7e47910548b4d1f17dc8e6e45b5dd4722
4
- data.tar.gz: 483c3d575cbe4dab8e18c2898f7e62e594d67846d55edd984c08261e98611efb
3
+ metadata.gz: 68ee37a3368b46ed10b4db2e410f307bd8dfa91a3cb4d6a4efc09cdd7d9f145d
4
+ data.tar.gz: 603055fe7b22a34c27afa5a21f68cbfef07c547620098cc6337e391e4254aecc
5
5
  SHA512:
6
- metadata.gz: 3af32b101d386980e623d9eced7e9e4fd882fb5185b56960888023ef72d4115e6ca669cf3199952c2f5599387826e31a3d2712250600d7a893d841580559bd2f
7
- data.tar.gz: d94eecf097300e5d1008bd62e55b6f24aeb23830bb864e572f774313b347f0efa3c0fe715a3833e2e8d439daefd849f3a9b981a63db2e3aff1f3e48b816f9f57
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
- 2. An unknown quote mode, file mode or option raises ArgumentError.
10
- 3. :unspecified, the name of the default.
11
- 4. :unquoted, the name of the mode reading no quotes, :none kept as an alias.
12
- 5. The reader chosen once, when the quote mode is set, as row_renderer is for writing.
13
- 6. .read and .open taking a path, and .parse text; a path which does not exist raising, and nothing inferred from whether a file exists.
14
- 7. attributes= setting columns, attributes always worked out from columns; rows read afterwards keyed by those names.
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
- 8. each yields each row as it is read.
19
- 9. each returns its receiver.
20
- 10. rows no longer filled by each.
21
- 11. Chunks from each_slice.
22
- 12. The source read once, start to end, with no rewind; the header from the first row read.
23
- 13. The line of an error found by seeking only where the source can.
24
- 14. A rewind left to r+ rewriting and to first_row called alone.
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
- 15. 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.
29
- 16. A benchmark script against stdlib CSV, and the README's speed sentence written from its output.
30
- 17. The README showing every mode by example, and a table matching each to stdlib CSV's and Python's settings.
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
- 18. A per-row fast path for the default: split, the fields bare or wrapped in two quotes unwrapped, any other row read in full.
35
- 19. as_array: returning the split fields, rather than building a Hash and then an Array from it.
36
- 20. Rows built by zip.to_h.
37
- 21. The scanner-based parser, at the tag scanner-parser-20261006, judged against the string operations used now.
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
- 22. :rfc_4180, a quote mode reading what RFC 4180 allows as :unspecified does and raising on what it forbids.
42
- 23. field_count:, :header or an Integer, off by default; a row of another width raising.
43
- 24. Writing with minimal quoting: a field quoted only where it holds a separator, a quote or a row terminator.
44
- 25. A line number in each parse error, and line_numbers:.
45
- 26. headers?, the instance-level header_row renamed, header_row kept as an alias.
46
- 27. <<, to append a row, and generate, to build a string.
47
- 28. Symbols and Strings interchangeable for column names, in a selection, a columns: list and a row's keys.
48
- 29. Duplicate headers by option: all kept as an Array, the default; indexed, a, a.1; first; last; error.
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
@@ -2,5 +2,5 @@
2
2
  # DSV::VERSION
3
3
 
4
4
  class DSV
5
- VERSION = '0.15.0'
5
+ VERSION = '0.16.0'
6
6
  end
data/lib/dsv.rb CHANGED
@@ -71,6 +71,7 @@ class DSV
71
71
  each(source, *args).select(&block)
72
72
  end
73
73
  alias_method :find_all, :select
74
+ alias_method :filter, :select
74
75
 
75
76
  def reject(source, *args, &block)
76
77
  each(source, *args).reject(&block)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran