dsv 0.12.4
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 +7 -0
- data/CHANGELOG +951 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +140 -0
- data/Rakefile +22 -0
- data/TODO +24 -0
- data/dsv.gemspec +43 -0
- data/lib/DSV/File.rb +35 -0
- data/lib/DSV/String.rb +19 -0
- data/lib/DSV/VERSION.rb +6 -0
- data/lib/dsv.rb +472 -0
- data/test/VERSION_test.rb +20 -0
- data/test/dsv_test.rb +702 -0
- data/test/gemspec_test.rb +42 -0
- data/test/helper.rb +9 -0
- metadata +97 -0
data/CHANGELOG
ADDED
|
@@ -0,0 +1,951 @@
|
|
|
1
|
+
# dsv/CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 20260913, 1005
|
|
4
|
+
|
|
5
|
+
0.12.4: + dsv(.rb).gemspec, Gemfile, Rakefile, .gitignore and LICENSE.
|
|
6
|
+
|
|
7
|
+
1. + dsv.gemspec and + dsv.rb.gemspec, two registrations of the one library, each named after its own file and each taking its version from DSV::VERSION: MIT, Ruby >= 3.2, development dependencies minitest ~> 6.0, minitest-mock and rake, and no runtime dependencies. minitest-mock is declared because test/helper.rb requires 'minitest/mock' for the one use of #stub in test/dsv_test.rb, and minitest 6 ships it as a gem of its own rather than within itself, so the suite will not load at all where that gem is absent; http.rb declares it already.; + Gemfile, Rakefile, .gitignore and LICENSE (MIT, 2006-2026), upon the pattern of http.rb and bitget.rb.
|
|
8
|
+
2. + test/helper.rb, which test/dsv_test.rb now requires in place of its own preamble; + test/VERSION_test.rb and test/gemspec_test.rb, upon bitget.rb's pattern. Run as `rake test`, or a file at a time as before.
|
|
9
|
+
3. test/gemspec_test.rb checks both gemspecs, each against its own file: that each is valid, pins no date, takes its version from DSV::VERSION, names the gem after its own file, ships its own gemspec and not the other, declares no runtime dependency, and declares minitest-mock. Run to 125.
|
|
10
|
+
4. ~ this CHANGELOG: /# CHANGELOG/# dsv\/CHANGELOG/, the name a file states being the file it is rather than the kind of file it is, and - the paragraph upon how the history is kept.
|
|
11
|
+
5. ~ lib/DSV/VERSION.rb: /0.12.3/0.12.4/.
|
|
12
|
+
6. Of the work the heading states, the gemspec, the packaging and the three test files fell upon the 13th; the second registration, minitest-mock, both gemspecs under test and this file's reformatting upon the 5th. The commit carries the 13th, where the greater part of it was done.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 20260913
|
|
16
|
+
|
|
17
|
+
0.12.3: + README.md.
|
|
18
|
+
|
|
19
|
+
1. + README.md, written once under the DSV name: what it is, reading, selecting columns, enumerating from the class, any delimiter, quoting, writing, r+, repeated header names, parse_line, and what it is not. It claims small, keyed access and any delimiter; speed is measured in 0.13.0 and reported there.
|
|
20
|
+
2. ~ TODO: the rename and the README done.
|
|
21
|
+
3. ~ lib/DSV/VERSION.rb: /0.12.2/0.12.3/.
|
|
22
|
+
|
|
23
|
+
0.12.2: + DSV::VERSION.
|
|
24
|
+
|
|
25
|
+
1. + lib/DSV/VERSION.rb, DSV::VERSION, the one place the version is stated, as http.rb has it; the date and version lines leave lib/dsv.rb's header for it and this CHANGELOG, and the $LOAD_PATH line goes with them, the gem and the test helper to come putting lib/ upon the path.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## 20260910
|
|
29
|
+
|
|
30
|
+
0.12.1: lib/ scoped to what the gem ships: the three core files, with what they used from the supporting files moved inside the class.
|
|
31
|
+
|
|
32
|
+
1. - the twenty-seven supporting files (_meta, Array, Hash, Object, OpenStruct, Struct, Thoran, and the blank? family), and their requires. Of them the library used four things: Array#extract_options!, now DSV.extract_options, the same line as a class method; Array#peek_options, now DSV::File#options; Object#blank?, asked of a Hash of columns, an Array of names and a selection, now the private blank?(value), nil? || empty?; and String#split_csv, the parser, now the private split_row taking the quote mode and separators from the instance, its reassembly loop as reassemble_quoted_fields, the same string operations, start_with? and end_with? in place of the four regex matches per piece. Array#to_csv and Hash#to_csv had not been called since 0.11.6 and 0.11.2; the other seventeen were reached only through Array#to_csv's object path, which the library never used. Nothing goes under Thoran::; there is nothing left to namespace. The originals stay in ~/lib/ruby for the live SimpleCSV and its other users.
|
|
33
|
+
2. ~ test/dsv_test.rb: - the examples of Array#to_csv and Hash#to_csv, which tested the removed files, and with them the skip on Finding 20, closed by the deletion. Run to 108, 2 skipped.
|
|
34
|
+
3. ~ lib/dsv.rb: /0.12.0/0.12.1/.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
0.12.0: /SimpleCSV/DSV/
|
|
38
|
+
|
|
39
|
+
1. /SimpleCSV/DSV/, /SimpleCSV::File/DSV::File/, /SimpleCSV::String/DSV::String/; lib/SimpleCSV.rb --> lib/dsv.rb, lib/SimpleCSV/ --> lib/DSV/, test/SimpleCSV_test.rb --> test/dsv_test.rb; the requires to match. The supporting files are still required under their old paths, and 0.11.18 being the last SimpleCSV that worked in full, this is that library under its new name: the suite passes as before with only the names changed. Run to 111, 3 skipped.
|
|
40
|
+
2. ~ lib/dsv.rb: /0.11.18/0.12.0/.
|
|
41
|
+
|
|
42
|
+
0.11.18: + TODO, and the header's Todo, Ideas and Bugs sections retired into it.
|
|
43
|
+
|
|
44
|
+
1. + TODO: what survives of the header's three sections and of _libraries/SimpleCSV/notes.txt, triaged: what is done or fixed is dropped with its version named in the reconciliation, and the rest is grouped as 0.12.0, decided; 0.13.0, speed; and features after, the guessing mode (separator, header, and a header made from the data where there is none), templated ingestion as a whole-row Regexp, the duplicate-header modes, the writing options, symbols and strings interchangeably, a strict: option, and a line number on parse errors.
|
|
45
|
+
2. ~ lib/SimpleCSV.rb: - the Todo, Ideas and Bugs sections; the header is the name, the date, the version and the description. /0.11.17/0.11.18/.
|
|
46
|
+
|
|
47
|
+
0.11.17: ~ SimpleCSV.header_row, the header row as names.
|
|
48
|
+
|
|
49
|
+
1. ~ SimpleCSV.header_row: returns the header row parsed into its names, as .attributes does, or nil where there is no header row; it had returned the instance's header_row accessor, true or false, the only thing the name could mean at the class level being the row (Finding 9). .first_row remains the raw first line. The instance-level accessor of the same name, the headers: option's value, is unchanged and is a 0.12.0 naming question.
|
|
50
|
+
2. ~ test/SimpleCSV_test.rb: + the class-level header_row with and without a header. Run to 111, 3 skipped.
|
|
51
|
+
3. ~ lib/SimpleCSV.rb: /0.11.16/0.11.17/.
|
|
52
|
+
|
|
53
|
+
0.11.16: ~ SimpleCSV#read and #each, selected_columns: given at construction is the selection when a call gives none.
|
|
54
|
+
|
|
55
|
+
1. + selection(): a call's own selection, or the instance's selected_columns: where the call gives none; #read and #each take theirs through it, and #parse, #to_a and the class methods follow. selected_columns: had been stored by #initialize and read by nothing (Finding 12). A single name or position is accepted as well as a list, and a call's own selection wins. Whether the selection becomes a keyword on the calls themselves is a 0.12.0 question; for now the option works under its name.
|
|
56
|
+
2. ~ test/SimpleCSV_test.rb: + the option at construction, a call overriding it, an Enumerator under it, and positions through the class-level read. Run to 110, 3 skipped.
|
|
57
|
+
3. ~ lib/SimpleCSV.rb: /0.11.15/0.11.16/.
|
|
58
|
+
|
|
59
|
+
0.11.15: ~ SimpleCSV#read, a second read gives the rows once.
|
|
60
|
+
|
|
61
|
+
1. ~ read(): the rows are those of this read, the source being rewound and read again; a second read had appended them to the first's, doubling them.
|
|
62
|
+
2. ~ test/SimpleCSV_test.rb: - the skip on the read-twice example. Run to 109, 3 skipped.
|
|
63
|
+
3. ~ lib/SimpleCSV.rb: /0.11.14/0.11.15/.
|
|
64
|
+
|
|
65
|
+
0.11.14: ~ SimpleCSV.open, the instance is a local, not a class-level variable.
|
|
66
|
+
|
|
67
|
+
1. ~ SimpleCSV.open: the instance it makes is held in a local for the block's duration and returned; it had been kept in the class's own @csv_file, shared across every call and every thread (Finding 22).
|
|
68
|
+
2. ~ test/SimpleCSV_test.rb: - the skip on the open example. Run to 109, 4 skipped.
|
|
69
|
+
3. ~ lib/SimpleCSV.rb: /0.11.13/0.11.14/.
|
|
70
|
+
|
|
71
|
+
0.11.13: ~ SimpleCSV::File#initialize, the path is expanded on construction.
|
|
72
|
+
|
|
73
|
+
1. ~ SimpleCSV::File#initialize: the filename is ::File.expand_path of what was given, so #filename is absolute and the file is opened by it (Finding 21). #filename had been @filename ||= File.expand_path(@filename), which never ran, @filename being set already, and which would have called SimpleCSV::File.expand_path had it run, File resolving inside the class to the class itself. - #filename, + attr_reader :filename.
|
|
74
|
+
2. ~ test/SimpleCSV_test.rb: - the skip on the expansion example. Run to 109, 5 skipped.
|
|
75
|
+
3. ~ lib/SimpleCSV.rb: /0.11.12/0.11.13/.
|
|
76
|
+
|
|
77
|
+
0.11.12: ~ SimpleCSV#each, an Enumerator without a block.
|
|
78
|
+
|
|
79
|
+
1. ~ each(): returns an Enumerator over the rows, the selection included, when no block is given (Finding 11); it had yielded regardless and raised LocalJumpError, so Enumerable's methods that call each without a block, and each('a').to_a, failed. include Enumerable is honest now.
|
|
80
|
+
2. ~ test/SimpleCSV_test.rb: - the skip on the enumerator example. Run to 109, 6 skipped.
|
|
81
|
+
3. ~ lib/SimpleCSV.rb: /0.11.11/0.11.12/.
|
|
82
|
+
|
|
83
|
+
0.11.11: ~ SimpleCSV#to_a, rows keyed by position come back as arrays in position order.
|
|
84
|
+
|
|
85
|
+
1. ~ to_a(): with no columns each row's values in their order, a position-keyed row holding them in position order (Finding 10); the branch had built an array in an inject and thrown it away, giving an empty array per row.
|
|
86
|
+
2. ~ test/SimpleCSV_test.rb: - the skip on the to_a example. Run to 109, 7 skipped.
|
|
87
|
+
3. ~ lib/SimpleCSV.rb: /0.11.10/0.11.11/.
|
|
88
|
+
|
|
89
|
+
0.11.10: ~ SimpleCSV.detect, nil when no row matches.
|
|
90
|
+
|
|
91
|
+
1. ~ SimpleCSV.detect: returns nil when the block is true for no row (Finding 8); the fall-through had been .each's return value, every row.
|
|
92
|
+
2. ~ test/SimpleCSV_test.rb: - the skip on the detect example. Run to 109, 8 skipped.
|
|
93
|
+
3. ~ lib/SimpleCSV.rb: /0.11.9/0.11.10/.
|
|
94
|
+
|
|
95
|
+
0.11.9: ~ SimpleCSV.read, .parse and .each, a column selection given before the options is honoured.
|
|
96
|
+
|
|
97
|
+
1. ~ SimpleCSV.read, ~ .each: the arguments before the options are the selection and go to the instance's #read or #each, as the two comments of 20240826 asked: SimpleCSV.read(source, 'a', headers: true) reads the a column alone (Finding 7). The names had been passed into new, which discarded them. .parse, .collect, .select, .reject and .detect go through .each and gain it likewise; the two comments go.
|
|
98
|
+
2. ~ test/SimpleCSV_test.rb: - the skip on the selection example, + the selection through .each and .parse. Run to 109, 9 skipped.
|
|
99
|
+
3. ~ lib/SimpleCSV.rb: /0.11.8/0.11.9/.
|
|
100
|
+
|
|
101
|
+
0.11.8: ~ SimpleCSV#initialize, the mode is normalised to Ruby's spelling whatever spelling it was given.
|
|
102
|
+
|
|
103
|
+
1. + SimpleCSV.normalised_mode(): the table that SimpleCSV::File#mode held, r, r+, w, w+, a and a+ as themselves and the long names read_only, rw, read_write, write_only and append to them, a Symbol as its String, unspecified as r. #initialize keeps @mode as that, so #columns's test of the mode against 'r', 'r+' and 'a+' holds for every spelling: mode: :r, :read_only and 'rw' read the header row (Finding 6). The parent had kept the option as given and SimpleCSV::File had normalised only its own copy, which the parent's #initialize then overwrote.
|
|
104
|
+
2. ~ SimpleCSV::File#mode: the same table by the same method; #mode reports Ruby's spelling.
|
|
105
|
+
3. ~ test/SimpleCSV_test.rb: - the skip on the mode example, + the reported mode for three spellings. Run to 109, 10 skipped.
|
|
106
|
+
4. ~ lib/SimpleCSV.rb: /0.11.7/0.11.8/.
|
|
107
|
+
|
|
108
|
+
0.11.7: ~ SimpleCSV#write_row, a nil value is an empty field, and a row with no columns defined is written from its own keys.
|
|
109
|
+
|
|
110
|
+
1. ~ write_row(): a nil value is written as an empty field, quoted as the mode quotes, so the columns after it keep their places, "1","","3" by default and 1,,3 under :none (Finding 16); it had skipped the value and shifted the rest left. With no columns defined the row's values are written in the row's own order (Finding 17); it had written nothing, silently.
|
|
111
|
+
2. ~ write(): with no columns defined and rows keyed by name, the columns, and the header when headers: is on, are taken from the first row's keys; rows keyed by position write positionally and have no header to write.
|
|
112
|
+
3. ~ columns(): memoised upon whether the header has been looked for rather than upon what it gave, a source with no header row yielding nil legitimately; ||= had looked again on every call, reading and rewinding the source, which when the source is the file being written read the rows just written back as a header. ~ columns=(): clears attributes and repeated_names, which are derived from it.
|
|
113
|
+
4. ~ test/SimpleCSV_test.rb: - the skip on the nil example, + nil under :none, + position-keyed and name-keyed rows written with no columns defined. Run to 109, 11 skipped.
|
|
114
|
+
5. ~ lib/SimpleCSV.rb: /0.11.6/0.11.7/.
|
|
115
|
+
|
|
116
|
+
0.11.6: ~ SimpleCSV#write_values, a row is rendered inside the class with the instance's separators, a quote inside a value doubled.
|
|
117
|
+
|
|
118
|
+
1. + row_renderer(): chosen once in #initialize from the quote mode and held; #write_values renders each row with it. The column and row separators are the instance's, so writing takes column_separator: and row_separator: as reading does and a file round-trips through both (Finding 23); it had joined with a literal comma through Array#to_csv and ended with #puts.
|
|
119
|
+
2. A quote inside a quoted value is doubled, "say ""hi""", as RFC 4180 has it and as #split_csv reads it since 0.11.4; it had been written once. Under :single the single quote is doubled likewise; under :none and :unquoted nothing is quoted or doubled.
|
|
120
|
+
3. The spacey modes, :spacey_double, :spacey_single, :spacey_none and :spacey_unquoted, put a space after each separator as Array#to_csv_row did; all seven spellings are kept.
|
|
121
|
+
4. The library no longer calls Array#to_csv; the require stays until Phase 4's scoping, with Hash#to_csv's.
|
|
122
|
+
5. ~ test/SimpleCSV_test.rb: - two skips (Finding 23 and the doubled quote), + a round trip through a pipe and CRLF, + the spacey modes. Run to 107, 12 skipped.
|
|
123
|
+
6. ~ lib/SimpleCSV.rb: /0.11.5/0.11.6/.
|
|
124
|
+
|
|
125
|
+
0.11.5: ~ SimpleCSV#columns, a repeated header name keeps every position, and a row holds its values as an Array.
|
|
126
|
+
|
|
127
|
+
1. ~ columns(): any name that occurs at more than one position maps to an Array of the positions, as an empty name alone did since 0.9.5; the special case goes. a,a,b gives {'a' => [0, 1], 'b' => 2} (Finding 5). columns=() given a list with a repeated name does the same.
|
|
128
|
+
2. ~ attributes(): a repeated name is the name at each of its positions, ['a', 'a', 'b'], where it had been '' at each.
|
|
129
|
+
3. + repeated_names(), + store_field(): a row's value under a repeated name is an Array, one value per position, in order: a,a,b over 1,2,3 reads {'a' => ['1', '2'], 'b' => '3'}, and row['a'][1] is the second. A file without a repeated name keeps the plain assignment loop, chosen per row by whether repeated_names is empty, so it pays nothing.
|
|
130
|
+
4. + values_in_order(): a row's values in position order, an Array under a repeated name spread back over its positions and a single value under one written at each; to_a, as_array and write_row all use it, so a repeated column round-trips.
|
|
131
|
+
5. The rule, for the README: a value is a String, or an Array where the header repeats the name; columns says which. Keying the repeats as distinct suffixed names (a, a.1), and keeping only the first or the last or refusing, are derivations of the same columns map and arrive later as options.
|
|
132
|
+
6. ~ test/SimpleCSV_test.rb: the empty-name example generalised to any repeated name, + reading, selecting, to_a, as_array and writing under one. Run to 106, 14 skipped.
|
|
133
|
+
7. ~ lib/SimpleCSV.rb: /0.11.4/0.11.5/.
|
|
134
|
+
|
|
135
|
+
0.11.4: ~ String#split_csv, the smallest changes that make it read RFC 4180 quoting correctly.
|
|
136
|
+
|
|
137
|
+
1. ~ String/split_csv.rb 0.8.0: the receiver is no longer chomped in place, a local copy being split (Finding 13); every path splits with -1 so a trailing empty field reads as "" (Finding 2); a doubled quote inside a quoted field reads as one quote (Finding 1); the separator is kept between the pieces of a quoted field that held more than one, and a piece that is a lone quote opens or closes a field rather than being an empty one, so a field that is only a separator reads (Finding 3); under :double a row that starts with a quote splits on quote-separator-quote and loses its outer quotes, so a separator inside a field is kept (Finding 4), and a row that does not start with one, a header row commonly, splits plainly. Direct string operations throughout, no scanner.
|
|
138
|
+
2. + SimpleCSV#complete_quoted_row(): while the quotes in a row are unbalanced the next line belongs to it, so a quoted field holding the row separator reads as one field across lines; only in the unspecified quote mode, where quotes are structure.
|
|
139
|
+
3. ~ test/SimpleCSV_test.rb: - seven skips (Findings 1, 2, 3, 4, 13 and the quoted field across lines), + :double with a wholly quoted header and a doubled quote, + one skip: a Regexp separator with a quoted field holding the separator still raises, reassembly concatenating the separator back in, which a Regexp cannot be. Run to 104, 14 skipped.
|
|
140
|
+
4. A scanner-based parser chosen once at construction, which also reads the Regexp case and was measured faster than this on every row shape, is parked on the branch scanner-parser for a later, deliberate change; correctness first, speed saved.
|
|
141
|
+
5. ~ lib/SimpleCSV.rb: /0.11.3/0.11.4/, and the date.
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## 20260909
|
|
145
|
+
|
|
146
|
+
0.11.3: - SimpleCSV::File.open and SimpleCSV::String.open, each of which constructed an instance and then had super construct another.
|
|
147
|
+
|
|
148
|
+
1. - SimpleCSV::File.open, - SimpleCSV::String.open: each built an instance, kept it in @csv_file, and called super, which built a second one and used that; the first was never closed, so a file was opened twice (Finding 19). SimpleCSV.open already constructs through new on whichever class it is called on, so the overrides added nothing but the leak.
|
|
149
|
+
2. ~ test/SimpleCSV_test.rb: - the two skips, one per class; each example now counts one construction. Run to 103, 22 skipped.
|
|
150
|
+
3. ~ lib/SimpleCSV.rb: /0.11.2/0.11.3/.
|
|
151
|
+
|
|
152
|
+
0.11.2: ~ SimpleCSV#write_header, the header row is the column names, selected or all, written as a row.
|
|
153
|
+
|
|
154
|
+
1. ~ write_header(): the names are written through the same path as a row's values, whether all the attributes or the selected columns. It had handed write_row() a String, the CSV rendering of the attributes, which worked only because String#[] finds each name inside its own rendering; and with columns selected it had handed Hash#to_csv the columns Hash, name to position, which wrote a blank line (Finding 18).
|
|
155
|
+
2. + write_values(): writes one row of values, quoted as @quote says; write_row() and write_header() both end here, so that the write path has one place to take the separators from when it does (Finding 23).
|
|
156
|
+
3. The library no longer calls Hash#to_csv anywhere; the require stays until Phase 4's scoping.
|
|
157
|
+
4. ~ test/SimpleCSV_test.rb: - the skip on the selected header example, and + the same under quote: :none. Run to 103, 24 skipped.
|
|
158
|
+
5. ~ lib/SimpleCSV.rb: /0.11.1/0.11.2/.
|
|
159
|
+
|
|
160
|
+
0.11.1: ~ SimpleCSV#write, the file is emptied at the first write under r+, not at the end of every read.
|
|
161
|
+
|
|
162
|
+
1. + prepare_to_rewrite(): under r+ reads the rows if they have not been read, then rewinds and truncates the file, once, before the header and rows are written. This is what the 2006 rewind and truncate at the end of #read were for, a read-then-rewrite of one file, moved to the write that the read was preparing for.
|
|
163
|
+
2. ~ SimpleCSV#read: - the rewind and truncate under r+. Reading no longer alters the file on disk, whether by #read, #each, #to_a, #count or any other Enumerable method, nor does a second #read find an empty file (Finding 15). A #write with the rows not yet read no longer loses its header to a truncate that followed it.
|
|
164
|
+
3. ~ test/SimpleCSV_test.rb: - the skip on the r+ example, and + two examples: reading under r+ by #read and by #count leaves the file as it was; #write under r+ with the rows unread rewrites the file with its header, and with rows set replaces it. Run to 103, 25 skipped.
|
|
165
|
+
4. ~ lib/SimpleCSV.rb: /0.11.0/0.11.1/.
|
|
166
|
+
|
|
167
|
+
0.11.0: + test/SimpleCSV_test.rb, and the header's Changes section retired to CHANGELOG.
|
|
168
|
+
|
|
169
|
+
1. + test/SimpleCSV_test.rb: MiniTest spec style, 102 examples. 76 pass and state the interface as it stands; 26 are skipped and state what the library should do and does not yet, each skip message naming its finding in the Handoff 0 closing note, so that the skip count is the fault list and each fix from here removes one skip. The RFC 4180 cases are rewritten from stdlib CSV's parsing tests. Run as `ruby test/SimpleCSV_test.rb`.
|
|
170
|
+
2. ~ lib/SimpleCSV.rb: - the Changes section of the header, its entries being here from 0.10.0 on; the date and version lines stay. From here each entry is written by hand, one per commit.
|
|
171
|
+
3. 0.10.4 was the last revision imported from the staging tree; from here every change is a commit.
|
|
172
|
+
|
|
173
|
+
### Note that prior to 0.10.4 predates this being in git.
|
|
174
|
+
|
|
175
|
+
## 20260905
|
|
176
|
+
|
|
177
|
+
0.10.4: Updated lib dependencies.
|
|
178
|
+
|
|
179
|
+
1. ~ Array/to_csv.rb: the 2014 version, which delegates to to_csv_header_row and to_csv_row and no longer requires _meta/default_to.
|
|
180
|
+
2. ~ Array/extract_optionsX.rb: a shim over Thoran/Array/ExtractOptionsX.
|
|
181
|
+
3. + The seventeen files those two require: the to_csv_row and to_csv_header_row families across Array, Hash, Object, OpenStruct and Struct, Object/is_one_ofQ, Object/to_h, Struct/to_h, and the two Thoran/ files.
|
|
182
|
+
4. - _meta/default_to, NilClass/default_to and Object/default_to, nothing requiring them any longer.
|
|
183
|
+
5. ~ SimpleCSV.read, ~ SimpleCSV.parse: two comments, dated 20240826, noting that column selection belongs in the class interface as it does in #read.
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 20200606
|
|
187
|
+
|
|
188
|
+
0.10.3
|
|
189
|
+
|
|
190
|
+
1. /CSVFile/SimpleCSV::File/
|
|
191
|
+
2. /CSVString/SimpleCSV::String/
|
|
192
|
+
3. Ensured that there are a number of leading class colon separators (::) in strategic places!
|
|
193
|
+
|
|
194
|
+
0.10.2
|
|
195
|
+
|
|
196
|
+
1. Separated CSVFile and CSVString into their own files.
|
|
197
|
+
2. require 'stringio' --> CSVString.rb
|
|
198
|
+
|
|
199
|
+
0.10.1: - ./test until such time as they are half-decent, which they have never been!
|
|
200
|
+
|
|
201
|
+
1. - ./test until such time as they are half-decent, which they have never been!
|
|
202
|
+
|
|
203
|
+
0.10.0
|
|
204
|
+
|
|
205
|
+
1. - SimpleCSV.rbd directory, moving everything up a directory, and SimpleCSV.rb inside the lib directory, so it now adheres to a more conventional Ruby library structure. May re-introduce .rbd, self-contained Ruby libraries one day, but will need to have the require overload work correctly and be able to load .rbd files correctly when presented. This may have changed sometime in the past quite a few years...
|
|
206
|
+
2. + lib/Kernel/silently.rb which was used in the speed testing file, but had never been incorporated into the lib directory as it should.
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
## 20191212
|
|
210
|
+
|
|
211
|
+
0.9.10: + attributes=(), so that the attributes from another instance of SimpleCSV can be copied across or just an array of attributes can be used.
|
|
212
|
+
|
|
213
|
+
1. + attributes=(), so that the attributes from another instance of SimpleCSV can be copied across or just an array of attributes can be used.
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
## 20111123
|
|
217
|
+
|
|
218
|
+
0.9.9
|
|
219
|
+
|
|
220
|
+
1. ~ SimpleCSV.parse, back to the way it was at 0.9.7, since the call to read will never require the block argument as it never makes it there.
|
|
221
|
+
2. Simplified the SimpleCSV eigenclass methods which were using open() by using new() instead, since this is more correct, more succinct, and more efficient.
|
|
222
|
+
3. Added SimpleCSV eigenclass collection methods: collect, select, reject, detect. I couldn't simply mixin Enumerable as I had with the instance methods, because I needed to be able to supply arguments other than a block.
|
|
223
|
+
4. + in SimpleCSV, alias_method :read_csv_header, :read_header in SimpleCSV.
|
|
224
|
+
5. + in SimpleCSV, alias_method :write_csv_header, :write_header.
|
|
225
|
+
6. + in SimpleCSV, alias_method :write_csv_row, :write_row.
|
|
226
|
+
7. + in SimpleCSV, alias_method :each_row, :each.
|
|
227
|
+
8. - CSVFile, attr_reader :filename, :args.
|
|
228
|
+
9. ~ CSVFile#mode, so as it makes use of the instance variable rather than the removed reader method args.
|
|
229
|
+
10. ~ CSVFile#mode, so it may accept hyphenated options for the mode aliases: read-only, read-write, write-only.
|
|
230
|
+
11. ~ CSVFile#permissions, so as it makes use of the instance variable rather than the removed reader method args.
|
|
231
|
+
12. ~ CSVFile#filename, by memoizing it.
|
|
232
|
+
13. ~ SimpleCSV#each, /rows/@rows/, so as there are fewer method invocations.
|
|
233
|
+
14. ~ SimpleCSV#columns, memozing first_row in the conditional, since this will be faster typically than doing the IO again.
|
|
234
|
+
15. + alias_method :find_all, :select.
|
|
235
|
+
16. + alias_method :find, :detect.
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## 20111111
|
|
239
|
+
|
|
240
|
+
0.9.8: 1. Proper handling of @row_separator and 2. a more full implementation of the class method interfaces.
|
|
241
|
+
|
|
242
|
+
1. ~ SimpleCSVe#parse_row, so as it assigns the index variable in fewer places.
|
|
243
|
+
2. Now using String#split_csv 0.7.0, which has an additional argument and associated code to handle the row_separator or the chomping that goes on in there...
|
|
244
|
+
3. ~ SimpleCSV#columns, introduced @row_separator into the call to String#split_csv.
|
|
245
|
+
4. ~ SimpleCSV#parse_row, introduced @row_separator into the calls to String#split_csv.
|
|
246
|
+
5. ~ SimpleCSV#initialize so that @quote now defaults to nil, allowing String#split_csv to handle heterogenously quoted lines.
|
|
247
|
+
6. ~ SimpleCSV.parse, so as the call to read() makes use of any block supplied.
|
|
248
|
+
7. ~ SimpleCSV.header_row, so as arguments can be supplied to the constructor.
|
|
249
|
+
8. ~ SimpleCSV.first_row, so as arguments can be supplied to the constructor.
|
|
250
|
+
9. ~ SimpleCSV.attributes, so as arguments can be supplied to the constructor.
|
|
251
|
+
10. ~ SimpleCSV.columns, so as arguments can be supplied to the constructor.
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
0.9.7: A better implementation of enabling @as_array
|
|
255
|
+
|
|
256
|
+
1. ~ SimpleCSV#read, so as the @as_array decisions are handled further down---in CSVFile#parse_row...
|
|
257
|
+
2. ~ SimpleCSV#parse_row, so as it returns an array instead of a hash if so desired.
|
|
258
|
+
3. ~ SimpleCSV#to_a, so as it handles the @as_array option.
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
## 20110402
|
|
262
|
+
|
|
263
|
+
0.9.6
|
|
264
|
+
|
|
265
|
+
1. + SimpleCSV.parse_line for FasterCSV compatibiity.
|
|
266
|
+
2. ~ SimpleCSV#initialize, + @column_separator in part for FasterCSV compatibility.
|
|
267
|
+
3. ~ SimpleCSV#columns, + @column_separator in part for FasterCSV compatibility.
|
|
268
|
+
4. ~ SimpleCSV#parse_row, + @column_separator in part for FasterCSV compatibility.
|
|
269
|
+
5. ~ SimpleCSV#initialize, ~ @source.
|
|
270
|
+
6. ~ CSVFile#initialize moved @source to own method.
|
|
271
|
+
7. + CSVFile#source.
|
|
272
|
+
8. + CSVFile#mode.
|
|
273
|
+
9. + CSVFile#permissions.
|
|
274
|
+
10. + CSVFile#filename.
|
|
275
|
+
11. ~ CSVString#initialize.
|
|
276
|
+
12. + CSVString#source.
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
## 20110217
|
|
280
|
+
|
|
281
|
+
0.9.5
|
|
282
|
+
|
|
283
|
+
1. ~ SimpleCSV#initialize, + options[:row_sep] as an optional key to set @row_separator with a view to some FasterCSV compatibility.
|
|
284
|
+
2. ~ SimpleCSV#columns, so as to gather empty header columns.
|
|
285
|
+
3. ~ SimpleCSV#attributes, so as it can handle the empty header columns compiled in columns().
|
|
286
|
+
4. This was bumped from 0.9.4 to 0.9.5 and an intermediate version which was 0.9.4 was left at that version number.
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
## 20100526
|
|
290
|
+
|
|
291
|
+
0.9.3: ~ SimpleCSV.rbd/lib/String/split_csv.rb
|
|
292
|
+
|
|
293
|
+
1. ~ SimpleCSV.rbd/lib/String/split_csv.rb
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
0.9.3
|
|
297
|
+
|
|
298
|
+
1. ~ SimpleCSV#initialize, so as the default quoting is :none, not :double.
|
|
299
|
+
2. + SimpleCSV#read_header, which I'd mistakenly taken out in the recent cull... for use with SimpleCSV#read.
|
|
300
|
+
3. ~ SimpleCSV#read, calls read_header, so the first line isn't pulled in as data.
|
|
301
|
+
4. ~ SimpleCSV#initialize, /use_array/as_array/.
|
|
302
|
+
5. ~ SimpleCSV#initialize, compressed a couple of the if statements, since they weren't complicated enough to be over 7 lines each.
|
|
303
|
+
6. ~ SimpleCSV#parse_row, logic was inverted for when @columns.blank? after a change in the logic for at 0.9.0!
|
|
304
|
+
7. ~ SimpleCSV#attributes, /columns/@columns.blank?/, and switched the logic order(!), since this is a little more robust and probably slightly faster too.
|
|
305
|
+
8. ~ SimpleCSV#to_a, so as it copes when there are not attributes (ie. no columns specified) and so it now uses each row's order value to sort by for the getting the correct column order.
|
|
306
|
+
9. ~ SimpleCSV#initialize, fixed manual column setting, so as it makes use of SimpleCSV#column=.
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
## 20100522
|
|
310
|
+
|
|
311
|
+
0.9.2
|
|
312
|
+
|
|
313
|
+
1. ~ SimpleCSV.read, contains SimpleCSV.read_rows.
|
|
314
|
+
2. ~ SimpleCSV.write, contains SimpleCSV.write_rows.
|
|
315
|
+
3. ~ SimpleCSV.header_row, simplified.
|
|
316
|
+
4. ~ SimpleCSV.first_row, simplified.
|
|
317
|
+
5. ~ SimpleCSV.attributes, simplified.
|
|
318
|
+
6. ~ SimpleCSV.columns, simplified.
|
|
319
|
+
7. - attr_accessor :rows, :quote, not being used.
|
|
320
|
+
8. - alias_method :lines, :rows, not being used.
|
|
321
|
+
9. - SimpleCSV#each_with_columns, rolled into SimpleCSV#each.
|
|
322
|
+
10. ~ SimpleCSV#each, rolled in SimpleCSV#each_with_columns and only output Hashes now.
|
|
323
|
+
11. - alias_method :lines, :rows, since a line is an unparsed row.
|
|
324
|
+
12. ~ SimpleCSV#initialize, it now makes use of SimpleCSV.source.
|
|
325
|
+
13. + SimpleCSV.parse, since it behaves slightly differently now from when it was an alias of SimpleCSV.read.
|
|
326
|
+
14. ~ SimpleCSV.read, is now tidier!
|
|
327
|
+
15. ~ SimpleCSV.write, is also a bit tidier!
|
|
328
|
+
16. + SimpleCSV.to_a, so as to give this sort of output.
|
|
329
|
+
17. + SimpleCSV.source_type.
|
|
330
|
+
18. + CSVFile#initialize.
|
|
331
|
+
19. + CSVString#initialize.
|
|
332
|
+
20. - require '_meta/default_to'.
|
|
333
|
+
21. - SimpleCSV#columns?, and using @columns.empty? instead in SimpleCSV#parse_row, since it is faster not to make that method call every row.
|
|
334
|
+
22. - SimpleCSV#read_row, now just SimpleCSV#parse_row.
|
|
335
|
+
23. - SimpleCSV#read_header, since it wasn't being used.
|
|
336
|
+
24. - SimpleCSV#rows?, using @rows[0] instead in SimpleCSV#each, since it is faster not to make that method call every row.
|
|
337
|
+
25. + SimpleCSV#parse, so as to mirror the changes in the class interface.
|
|
338
|
+
26. ~ SimpleCSV#read, so as to accommodate the creation of SimpleCSV#parse as per the class interface.
|
|
339
|
+
27. - require 'Index' and the file from ./lib also, since it wasn't being used still.
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
## 20100521
|
|
343
|
+
|
|
344
|
+
0.9.1
|
|
345
|
+
|
|
346
|
+
1. ~ SimpleCSV.rbd/SimpleCSV.rb: - require 'profile' if false
|
|
347
|
+
2. ~ SimpleCSV.rbd/SimpleCSV.rb: + require 'profile' if true
|
|
348
|
+
3. - SimpleCSV.rbd/lib/Array/quote_each.rb
|
|
349
|
+
4. - SimpleCSV.rbd/lib/Array/to_csv_double_quoted.rb
|
|
350
|
+
5. - SimpleCSV.rbd/lib/Array/to_csv_single_quoted.rb
|
|
351
|
+
6. - SimpleCSV.rbd/lib/Array/to_csv_spacey_double_quoted.rb
|
|
352
|
+
7. - SimpleCSV.rbd/lib/Array/to_csv_spacey_single_quoted.rb
|
|
353
|
+
8. - SimpleCSV.rbd/lib/Array/to_csv_spacey_unquoted.rb
|
|
354
|
+
9. - SimpleCSV.rbd/lib/Array/to_csv_unquoted.rb
|
|
355
|
+
10. - SimpleCSV.rbd/lib/Array/wrap_each.rb
|
|
356
|
+
11. - SimpleCSV.rbd/lib/String/split_csv_double_quoted.rb
|
|
357
|
+
12. - SimpleCSV.rbd/lib/String/split_csv_mixed_quoted.rb
|
|
358
|
+
13. - SimpleCSV.rbd/lib/String/split_csv_unquoted.rb
|
|
359
|
+
14. - SimpleCSV.rbd/lib/String/unwrap.rb
|
|
360
|
+
15. - SimpleCSV.rbd/lib/String/wrap.rb
|
|
361
|
+
16. ~ SimpleCSV.rbd/SimpleCSV.rb
|
|
362
|
+
17. ~ SimpleCSV.rbd/lib/Array/to_csv.rb
|
|
363
|
+
18. ~ SimpleCSV.rbd/lib/String/split_csv.rb
|
|
364
|
+
19. ~ SimpleCSV.rbd/test/test.rb
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
0.9.0
|
|
368
|
+
|
|
369
|
+
1. /CSVFile/SimpleCSV/.
|
|
370
|
+
2. Reset the Todo list and rolled in the Goals to that.
|
|
371
|
+
3. Moved the loader stuff (Array, Hash, String) in here.
|
|
372
|
+
4. More changes to interfaces to reflect the change in 0.8.0 to interface arguments.
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
## 20100503
|
|
376
|
+
|
|
377
|
+
0.8.2
|
|
378
|
+
|
|
379
|
+
1. Removed some requires, since I have a general purpose loader CSVFile.rb to load files in the CSVFile library now.
|
|
380
|
+
2. + attr_accessor :mode.
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
## 20100325
|
|
384
|
+
|
|
385
|
+
0.8.1: Simplified the CSVFile.new, @mode options.
|
|
386
|
+
|
|
387
|
+
1. Simplified the CSVFile.new, @mode options.
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
## 20100316
|
|
391
|
+
|
|
392
|
+
0.8.0: A significant change to the CSVFile.new interface. I should probably bump it to 0.8.0. This breaks compatibility with the File.new method which I was wanting...
|
|
393
|
+
|
|
394
|
+
1. A significant change to the CSVFile.new interface. I should probably bump it to 0.8.0. This breaks compatibility with the File.new method which I was wanting...
|
|
395
|
+
2. + CSVFile.rb, a loader for the CSVFile library, the requires moving out of CSVFile/CSVFile.rb; the library and its lib/ move under CSVFile/.
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
## 20100113
|
|
399
|
+
|
|
400
|
+
0.7.2
|
|
401
|
+
|
|
402
|
+
1. More swapping out of line for row.
|
|
403
|
+
2. ~ #read...
|
|
404
|
+
3. + #set_columns.
|
|
405
|
+
4. + #readrow.
|
|
406
|
+
5. /write_csv/write/.
|
|
407
|
+
6. alias_method :write_csv, :write
|
|
408
|
+
7. + #each_csv.
|
|
409
|
+
8. + #csv_each.
|
|
410
|
+
9. ~ #each_with_columns, since it hasn't been touched yet. Actually, do I really need it?
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
## 20100112
|
|
414
|
+
|
|
415
|
+
0.7.1
|
|
416
|
+
|
|
417
|
+
1. Moved CSVFile singleton methods to the top of the CSVFile class.
|
|
418
|
+
2. More emphasizing of #.*row methods, moving any #.*line methods to aliases.
|
|
419
|
+
3. + .header_row
|
|
420
|
+
4. + .first_row
|
|
421
|
+
5. + .attributes
|
|
422
|
+
6. + .columns
|
|
423
|
+
7. /#read_csv/#read/.
|
|
424
|
+
8. ~ #do_read to use parse_row instead of parse_line.
|
|
425
|
+
9. + alias_method :parse_row, :read_row
|
|
426
|
+
10. ~ #columns=, fixed when taking a hash.
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
0.7.0
|
|
430
|
+
|
|
431
|
+
1. Removed all the debug stuff.
|
|
432
|
+
2. require'ing of String placed in Array.rb.
|
|
433
|
+
3. include Enumerable.
|
|
434
|
+
4. /line/row/.
|
|
435
|
+
5. /separator/row_separator/.
|
|
436
|
+
6. ~ #read_csv.
|
|
437
|
+
7. + #do_read.
|
|
438
|
+
8. + #read_header.
|
|
439
|
+
9. Using more getters and setters than instance variables. Need to check speed effects of those changes...
|
|
440
|
+
10. + #header_row?
|
|
441
|
+
11. ~ CSVFile.writelines, + row_separator parameter.
|
|
442
|
+
12. ~ #columns=, takes a splat.
|
|
443
|
+
13. + lib/Index.rb; ~ lib/String.rb.
|
|
444
|
+
14. - spec/spec.rb; + test/ and coulda/spec.rb in its place; ~ tmp/test.rb.
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
## 20090105
|
|
448
|
+
|
|
449
|
+
0.6.2: A default separator for CSVFile.each, and two unused Array extensions set aside.
|
|
450
|
+
|
|
451
|
+
1. ~ lib/CSVFile.rb: ~ CSVFile.each: separator defaults to "
|
|
452
|
+
", as the instance method's already did.
|
|
453
|
+
2. ~ lib/Array.rb: - each_with_index(), - collect_with_index(), commented out, Array#each_with_index existing already.
|
|
454
|
+
3. ~ tmp/test.rb
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
0.6.1
|
|
458
|
+
|
|
459
|
+
1. Split the standard ruby library extensions into own files.
|
|
460
|
+
2. Added a separator option in all interfaces, as is consistent with File/IO, even if it probably doesn't get used. (Maybe piss it off too?...)
|
|
461
|
+
3. CSVFile#headers, aliased from CSVFile#attributes.
|
|
462
|
+
4. Corrected some errors in the class methods.
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
## 20071029
|
|
466
|
+
|
|
467
|
+
0.6.0: Began the 0.6 line with the library file alone, the 0.5 tests set aside.
|
|
468
|
+
|
|
469
|
+
1. ~ lib/csv_file.rb: + opening_quote?(), + closing_quote?(), + opening_and_closing_quotes?(), + opening_or_closing_quotes?(), + opening_xor_closing_quotes?(), + neither_opening_nor_closing_quotes?(), so that csv_split() can say which state a field is in.
|
|
470
|
+
2. ~ lib/csv_file.rb: ~ csv_split(): tracks whether quotes are open through those predicates rather than a quote_found flag.
|
|
471
|
+
3. ~ lib/csv_file.rb: + each_char(), + each_with_index(), + collect_with_index(), String and Array helpers the parser wants.
|
|
472
|
+
4. ~ lib/csv_file.rb: ~ initialize()
|
|
473
|
+
5. - test/, the whole 0.5 tree with its FasterCSV comparisons; spec/ and tmp/ take its place at 0.6.1.
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
## 20071023
|
|
477
|
+
|
|
478
|
+
0.5.11
|
|
479
|
+
|
|
480
|
+
1. The interface for the CSVFile#initialize method is now the same as File. Defaults are set for header_line and quote and accessors are now available for both.
|
|
481
|
+
2. The same has been done for the class method CSVFile.open, but I'm not sure that making the interface there the same as for file is necessary or a good idea.
|
|
482
|
+
3. All the class methods within CSVFile are now wrapped within a 'class << self' section.
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
## 20070422
|
|
486
|
+
|
|
487
|
+
0.5.10
|
|
488
|
+
|
|
489
|
+
1. /read/read_csv/.
|
|
490
|
+
2. Dropped in some class methods which are File/IO interface similarity/compatibility stuff (open, readlines, read, write, writelines) written between 0.6.4 and 0.6.5 as per notes2.txt.
|
|
491
|
+
3. Added some aliases for read and write: read_csv and write_csv.
|
|
492
|
+
4. Removed self.class from expand_path in self.open.
|
|
493
|
+
5. CSVFile.open is having some trouble passing on the mode to the instance in a block. See Interesting 0.7.3.
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
## 20070408
|
|
497
|
+
|
|
498
|
+
0.5.9: Now trying #read from 0.5.4.
|
|
499
|
+
|
|
500
|
+
1. Now trying #read from 0.5.4.
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
0.5.8
|
|
504
|
+
|
|
505
|
+
1. CSVFile#initialize was attempting to convert the default boolean value to a symbol. So it now checks if it is a boolean before attempting to convert it.
|
|
506
|
+
2. I stopped CSVFile#init from trying to set the size of the columns before there was anything there for when the mode is write. Need to be more complete about it though and check that I shouldn't also do 'w+' and several others.
|
|
507
|
+
3. Removed the reference to $columnt_count because it is no longer being used!
|
|
508
|
+
4. Enabled the #write_header debug switch at the top.
|
|
509
|
+
5. #write_line only adds columns to the array now if an element is not nil.
|
|
510
|
+
6. Pasted #read from 0.5.6 back here, since it wasn't reading correctly.
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
## 20070302
|
|
514
|
+
|
|
515
|
+
0.5.7: I noticed while I was browsing my code on thoran.com that I could speed things up a bit in read...
|
|
516
|
+
|
|
517
|
+
1. I noticed while I was browsing my code on thoran.com that I could speed things up a bit in read...
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
## 20070104
|
|
521
|
+
|
|
522
|
+
0.5.6
|
|
523
|
+
|
|
524
|
+
1. For completeness I added String#wrap!, #unwrap!, #quote!, #unquote!.
|
|
525
|
+
2. A bit of tidying, removing unused/commented out code and reintroducing commented out code.
|
|
526
|
+
3. Added aliases #write_row, #writerow for #write_line.
|
|
527
|
+
4. Replaced all instances of "@columns.sort{|a,b| a[1] <=> b[1]}.collect{|a| a[0]}" with "attributes" since #attributes is just that.
|
|
528
|
+
5. #write_header now accepts columns as an array as well as a parameter list.
|
|
529
|
+
6. #attributes now copes for when there is no header line.
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
## 20061207
|
|
533
|
+
|
|
534
|
+
0.5.5
|
|
535
|
+
|
|
536
|
+
1. I modifed the regexes for the auto-detection part of String#csv_split to include zero or more spaces after the comma. I still need to break up this auto-detection stuff to separate out spacey at least, if not strict by some means...
|
|
537
|
+
2. Fixed a few issues with #write_line. That is an understatement.
|
|
538
|
+
3. Modified #write_csv to write a header line.
|
|
539
|
+
4. Moved the header writing stuff to its own method #write_header and added a reference to this in #write_csv.
|
|
540
|
+
5. Commented out all the typically, and only fairly recently, unused bits in #read_line to see if it made a speed difference. It didn't. At least it was essentially undetectable.
|
|
541
|
+
6. Lispyified and compressed #read some by using parentheses, expression/statements, and collect. I don't know if this will make it any faster though.
|
|
542
|
+
7. So far I've wiped roughly 1/3 of the time taken to do a read since 0.5.3!
|
|
543
|
+
8. #attributes now calls #columns, which will pass back @columns if it is available, or generate it if not, instead of doing file accesss and csv_split, which I expect is more'expensive' than a collect. And I realise that #init calls both #columns and attributes.
|
|
544
|
+
9. I've commented out the assignment to @attributes in the #init method because of the way that I've now done it, that if attributes is called, it will call #columns on demand, rather than pre-loading for no difference in cost excepting that it is not always being run, making this overall more efficient, except if I'm calling #attributes a lot, rather than relying upon @attributes having been set during #init...
|
|
545
|
+
10. I temporarily commented out the code which does the removal of multiple commas and produces a more consistent format and found that (with profiling on) the time taken when tested on 5.csv dropped from 0.65 to 0.40! That's a 40% drop in time. I really need to fix that up with a decent regex...
|
|
546
|
+
11. In String#csv_split I only do one #sub now. One less method call per line!
|
|
547
|
+
12. Added $column_count in #init to be used in #csv_split to reduce the number of calls to size, although of course if the line has more or less elements than this it will screw up... This is just a bit of an experiment really.
|
|
548
|
+
13. Now doing the first element and last element subs in-place.
|
|
549
|
+
14. Stopped using $column_count in #csv_split.
|
|
550
|
+
15. @columns now uses symbols for its keys.
|
|
551
|
+
16. Standardized on symbols in #init for @header_line.
|
|
552
|
+
17. Started to fill out the distinctions between the different quoting types with the none series having different regexes to split by.
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
## 20061206
|
|
556
|
+
|
|
557
|
+
0.5.4
|
|
558
|
+
|
|
559
|
+
1. A bunch of debug lines excised---again!
|
|
560
|
+
2. Added quote_each, #quote_each!, #unquote_each, #unquote_each! and changed the calls to wrap_each to quote_each.
|
|
561
|
+
3. String#quote and #unquote to support the Array quoting stuff.
|
|
562
|
+
4. Tightened up #read to be much more character-efficient.
|
|
563
|
+
5. Added a bunch of additional options to selecting whether there is a header line, so that now one can be a little more informative when specifying a header line than simply 'true'; such as ':header_line'.
|
|
564
|
+
6. Changed the options on header line to include strings and not just symbols. I can't do the to_s or to_sym thing because I have booleans. Well I could if I dropped in my TrueClass and FalseClass#to_s methods!
|
|
565
|
+
7. Did the same thing as was done for @header_line for @mode. I can now use more easily-remembered and obvious options like ':read_only'.
|
|
566
|
+
8. I don't know what I did, but I've knocked another 0.03 seconds off for the test_data.csv file, making it roughly another 15% faster and now over 3x faster than FasterCSV!
|
|
567
|
+
9. Changed Array#to_csv to make use of Array#quote_each instead; which just calls #wrap_each anyway. I may have #quote_each replicate the content of #wrap_each and then call String#quote instead.
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
0.5.3
|
|
571
|
+
|
|
572
|
+
1. Added Array#wrap_each!, #unwrap_each, and #unwrap_each! and various aliases for each.
|
|
573
|
+
2. Redid all the Array#wrap_each and all the other wrapping methods in a much tighter way than was done with #wrap_each before.
|
|
574
|
+
3. Added String#unwrap. Not sure how this will be used yet, or if at all, but I suspect it might be of use to String#csv_split.
|
|
575
|
+
4. Removed a bunch of debugging.
|
|
576
|
+
5. Did some speed testing last night against the standard CSV file used for testing I think for both FasterCSV and CSV and found quite a few bugs!
|
|
577
|
+
6. Firstly the #read method was rooted. I had to almost completely redo the parsing loop. When @columns was available it was completing misloading the keys for each line. There was also an unnecessary option on both when @columns was specified and when it wasn't to test for supplied columns, since it wasn't either or, I need both columns and @columns. And using the same name is a bit confusing, @ or not.
|
|
578
|
+
7. Also the column stuff in #read was rooted as well as the column order was coming out in the hash order and not the column order. I've done a little bit of inline sorting magic, but really I could architect this better 3x faster than FasterCSV or not. Once I tidy things up in #read and in #csv_split, I think I'd be able to get an additional 2 - 4x performance increase.
|
|
579
|
+
8. Switched to not using 'self.' for most things.
|
|
580
|
+
9. Modifed #read_line such that it will feed in @columns into #csv_split, rather than loading @columns into columns in #csv_split.
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
## 20061205
|
|
584
|
+
|
|
585
|
+
0.5.2
|
|
586
|
+
|
|
587
|
+
1. Compressed #write_csv and #write_line. Possibly more readable, possibly not.
|
|
588
|
+
2. Did the same (compresses) for Array#wrap_each.
|
|
589
|
+
3. Added String#wrap to be used in conjunction with Array#wrap_each and changed Array#wrap_each accordingly.
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
0.5.1
|
|
593
|
+
|
|
594
|
+
1. Moved what remained of CSVFile#to_csv into #write_line and deleted CSVFile#to_csv.
|
|
595
|
+
2. Created Array#wrap_each (formerly called just wrap) to simplify Array#to_csv.
|
|
596
|
+
3. Fixed a small error in logic with #write_line. It is difficult when a method accepts all manner of inputs. I was a little confused again about what's a Hash and what's an Array.
|
|
597
|
+
4. Fixed a small scoping problem on Array#wrap_each. 'a' wasn't accessible outside the loop.
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
0.5.0
|
|
601
|
+
|
|
602
|
+
1. Rearranged things a little. Put read_line next to read, etcetera.
|
|
603
|
+
2. Added some aliases for :write_csv and some for :read_line.
|
|
604
|
+
3. Modified #read_line, such that if the column isn't specified that it will return the whole line parsed into an array.
|
|
605
|
+
4. I've optimised #read such that if no columns are specified then it will read the whole line in a go, rather than one column at a time. I can optimise this further and simplify it by calling parse_line once only for all circumstances.
|
|
606
|
+
5. Removed the when Array bizzo from #write_csv, since I'm simply passing that into #write_line anyway, so I thought I'd let it handle it by passing it through as found, and so added * to columns and removed the remainder.
|
|
607
|
+
6. Aliased #write_csv to #csv_write. I think I prefer this and may swap, but which I'll be consistent and do the same with #csv_split.
|
|
608
|
+
7. Aliased #csv_split to #split_csv as per 6.
|
|
609
|
+
8. Improved the debugging switches so that they are now a Hash.
|
|
610
|
+
9. The quote to use when line splitting can now be specified in the call to #csv_split and via reference to it having been set elsewhere via @quote.
|
|
611
|
+
10. To that (Change#9) end I now have the same list of quote types as in the #to_csv methods.
|
|
612
|
+
11. I added unquoted options to the quote types.
|
|
613
|
+
12. Created Array#to_csv to refactor both the Hash and CSVFile#to_csv stuff, so the bulk of both of those methods has been gutted and moved to Array#to_csv.
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
## 20061204
|
|
617
|
+
|
|
618
|
+
0.4.10
|
|
619
|
+
|
|
620
|
+
1. Now doing the usual bit of a cleanout after a typically frustrating session of coding.
|
|
621
|
+
2. Moved the methods created on Hash to outside CSVFile.
|
|
622
|
+
3. I removed references to @columns, since that is no longer (well never was actually) accessible. The to_csv method will now output in the hash order, and not the default order. This is bad... OrderedHash anyone?
|
|
623
|
+
4. I now have essentially reversed 46, by virtue of the fact that I have the file object available to me and so I can send the columns? and columns messages to that!
|
|
624
|
+
5. Added :quote as an attr for use in Hash#to_csv, since @quote don't work no more...
|
|
625
|
+
6. Now I had to make an @file variable and read the Hash#write parameter file into it for use in Hash#to_csv. It gets uglier and uglier...
|
|
626
|
+
7. Hash#write had a bug: I forgot to take the first value of the test but of the whole, so only first attribute/column was being sought!
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
0.4.9
|
|
630
|
+
|
|
631
|
+
1. - test/9a.csv
|
|
632
|
+
2. + test/9b.csv
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
0.4.9
|
|
636
|
+
|
|
637
|
+
1. #write_csv now copes with arrays being supplied to it, and not array parameter lists.
|
|
638
|
+
2. #write_line also has been swapped to being able to handle parameter lists and not just arrays---the opposite of #write_csv.
|
|
639
|
+
3. Added an alias #csv_write for #write_csv.
|
|
640
|
+
4. Added a couple of aliases for #write_line: writeline and writeln.
|
|
641
|
+
5. In order to try and achieve Goal 1.3 I've created the methods write and to_csv on Hash and since they make reference to an instance variable of CSVFile I've placed it into CSVFile. Much of the code is taken from CSVFile#to_csv. It was complicated, as is much of this become quite baroque, by virtue of the attempt to handle many inputs. It will handle for when either an array or a parameter list is supplied, it will handle for when a list of columns is desired or not, it will even handle if there are no columns in the @columns instance variable. I hope that the scoping for that works because @columns exists in CSVFile which surrounds these extensions to Hash.
|
|
642
|
+
6. I decided that the alias each_with_columns for each was incorrect, so wrote what I thought each_with_columns would really do and that it is return columns for all supplied parameters including not supplied parameters, not just if they are supplied like each does. I'm not sure if I will leave each to produce anything with columns, whether it calls each_with_columns or not. This is also rather complicated, and again by virtue of the inputs and contexts being able to be handled as being quite diverse. It copes with arrays and paramters lists as inputs and with whether any columns were supplied at all, as well as with whether there are any lines in the csv file buffer, @lines.
|
|
643
|
+
7. I finally finished CSVFile#to_csv with the fixes (derived from the reverse of String#csv_split) for everthing other than my original fix for :doubly_quoted. Of course I waited until I'd reproduced the code for Hash#to_csv huh!? Copy, paste...
|
|
644
|
+
8. I didn't need the alias for File#write anymore, so that's been left but commented. (For when I get CSVFile#write working!)
|
|
645
|
+
9. Added in a method and instance variable @attributes. I realized that I had forgotten or misinterpreted that @columns was a hash, because the passed in column list is an Array. So I thought I'd do an array version of the list of column names, hence attributes. The funny thing was that I didn't have any obvious need for it until I started hunting in frustration for some alternative means to get #each_with_columns working. So, I've already made use of it there.
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
## 20061203
|
|
649
|
+
|
|
650
|
+
0.4.8
|
|
651
|
+
|
|
652
|
+
1. Is the reason that the 'w+' mode wasn't working for overwriting due to the columns not being read? Up till now I've only had 'r' and 'r+' causing columns to be read... I'll comment out the rewind and truncate stuff at the end of #read and change that bit in #init to include 'w+' and 'a+' and see what happens.
|
|
653
|
+
2. No it isn't, so I've left in the 'a+' option and taken the 'w+' out since what am I going to read anyway since the superclass call is made prior anyway causing the file to be truncated to zero! Doh!
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
0.4.7
|
|
657
|
+
|
|
658
|
+
1. I've made a small change to CSVFile#read, whereby it rewinds as the last thing that it does before returning @lines if the mode is set to 'r+'... Hopefully now it will over-write...
|
|
659
|
+
2. Created @mode and read mode into it in #init! Also changed mode to @mode in #read.
|
|
660
|
+
3. It is simply overwriting the same number of bytes and not lines, so that means that if the number of bytes is shorter than the starting contents, that will overwrite only part of the file, so I'm going to truncate the file at the end of #read now!
|
|
661
|
+
4. I need to do both rewind and overwrite each byte. Well, at least I'll try this...
|
|
662
|
+
5. Nope---probably doing something wrong. So now, I'm trying the truncate method...
|
|
663
|
+
6. I didn't realise that truncate doesn't have a no parameters default. Should it?
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
## 20061201
|
|
667
|
+
|
|
668
|
+
0.4.6
|
|
669
|
+
|
|
670
|
+
1. - test/6.3.csv
|
|
671
|
+
2. + test/6.4.csv
|
|
672
|
+
3. ~ test/test.rb
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
0.4.6
|
|
676
|
+
|
|
677
|
+
1. - test/6.2.csv
|
|
678
|
+
2. + test/6.3.csv
|
|
679
|
+
3. ~ test/test.rb
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
0.4.6
|
|
683
|
+
|
|
684
|
+
1. - test/6.1.csv
|
|
685
|
+
2. + test/6.2.csv
|
|
686
|
+
3. ~ test/test.rb
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
0.4.6
|
|
690
|
+
|
|
691
|
+
1. - test/6.0.csv
|
|
692
|
+
2. + test/6.1.csv
|
|
693
|
+
3. ~ test/test.rb
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
0.4.6
|
|
697
|
+
|
|
698
|
+
1. /#write/#write_csv/. This is a temporary measure(I think?) until I can figure out to get #write to co-exist with IO#write.
|
|
699
|
+
2. /attr_read :lines/attr_accessor :lines/ for when assigning an out file the in file's values. This seems pretty cludgy, but we'll go with it for now.
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
0.4.5
|
|
703
|
+
|
|
704
|
+
1. Finally on to the writing stuff. Although I think the changes to each method might be of some use...
|
|
705
|
+
2. Swapped read_line and parse_line, for no other reason than consistency.
|
|
706
|
+
3. Added in a couple of compatibility parameters to #init which allow for setting mode and permissions on the call to this method in the File superclass.
|
|
707
|
+
4. Created methods write, write_line, and to_csv which are all to support dumping of data to a CSV file as per Goal#1.
|
|
708
|
+
5. Created a method #lines? to support nicer querying as to whether there is any data read from the CSV file.
|
|
709
|
+
6. Took the debugging and reformatted #each a little.
|
|
710
|
+
7. Added an alias #read? for #lines?.
|
|
711
|
+
8. Added in && ['r', 'r+'].include?(mode) to the line of #initialize which sets the column names, since if a file is not open for reading, then I shouldn't be trying to read from it!
|
|
712
|
+
9. Changed #to_csv, such that it now doesn't try to add files to the collector if that column isn't specified. Now, by way of using columns and not @columns, whereas before I had this silly if include thing?...
|
|
713
|
+
10. Added format/quote to the #init interface---pushing the standard file paramters yet further up the chain. I may reorder these, but as they have defaults...?
|
|
714
|
+
11. There's a conflict between my attempted use of File(< IO)#puts and CSVFile#write, since File#puts calls #write and an infinite loop, or till the stack is used up ensues. It is working at the moment, but only if I don't call write, but use write_line instead (which was the case anyway) and if it is commented out!
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
0.4.4
|
|
718
|
+
|
|
719
|
+
1. Almost added the to_s I suspected was missing to make #each work with symbols, but realised why I didn't immediately need to do so.
|
|
720
|
+
2. Swapped out the def for rows for an alias on lines.
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
0.4.3
|
|
724
|
+
|
|
725
|
+
1. Removed #each_with_columns and (for backwards compatibility?) made it an alias for #each, whilst rolling in the bit of code with generates multiple return values.
|
|
726
|
+
2. The only thing lost by doing this is that it is not longer possible to specify which columns are to be collected and then to have a single line parameter returned to the block. No great loss methinks.
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
0.4.2: Majorly mangled #each_with_columns (so as to make it work) by collecting each of the supplied parameters and yielding the resulting array.
|
|
730
|
+
|
|
731
|
+
1. Majorly mangled #each_with_columns (so as to make it work) by collecting each of the supplied parameters and yielding the resulting array.
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
0.4.1
|
|
735
|
+
|
|
736
|
+
1. Added alias_method :read_line, :parse_line.
|
|
737
|
+
2. Instead of a def I now have alias_method :parse, :read.
|
|
738
|
+
3. Added alias_method :each_with_line, :each.
|
|
739
|
+
4. Created #each_with_columns. Incomplete as it only handles when columns are defined for now. Copied from #each. Time to test...
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
0.4.0
|
|
743
|
+
|
|
744
|
+
1. Changed the def to an alias for #csv_file_each.
|
|
745
|
+
2. I thought I did this already (Maybe I forgot?)---in #each: read; @lines.each --> read.each. Much nicer. I'm sure I wrote this down as done before (in 0.3.7 or 8)!
|
|
746
|
+
3. Added a conditional into #each for when one or more columns are desired.
|
|
747
|
+
4. Changed all the scans to matches in #csv_split because a non-match returns nil and that's a little cleaner than what scan returns. And yes, match works both ways: String.match(Regex) as well as Regex.match(String).
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
0.3.8
|
|
751
|
+
|
|
752
|
+
1. #read now returns @lines.
|
|
753
|
+
2. Added a couple more aliases for File#each.
|
|
754
|
+
3. Made CSVFile#each smarter, such that it will now attempt to read the file if it hasn't been read yet. It only does a default read presently and doesn't take desired columns, which would need to be fed into the each method first. (I had this in mind, but was waiting for a later version. It just started to happen! I was thinking a few hours ago that it would be really sweet to be able to do something like csv_file.each('name', 'address', 'phone') do |name, address, phone|... I would still want to retain it returning lines however, so I'd have to make sure that by entering parameters it defaulted to returning lines and returning only one value in the yield. I don't know why Matz doesn't like that stuff!
|
|
755
|
+
4. I just realised that I could rewrite #each such that I can dispense with the @lines: /read; @lines.each do/read.each do/, since read now returns @lines! Nice.
|
|
756
|
+
5. Created #csv_file_each to accompany #file_each.
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
0.3.7
|
|
760
|
+
|
|
761
|
+
1. Finished the changes required in #csv_split. I really need to change this stuff though.
|
|
762
|
+
2. In #csv_split changed the value of old_result to simply self. It was an aesthetics thing, even though it might have been marginally quicker leaving it as it was.
|
|
763
|
+
3. Changed #csv_split again to accommodate the edge case where the line has nothing but commas until the last column. The scans for quotes would fail under such circumstances as it was.
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
0.3.6: Significantly re-did String#csv_split.
|
|
767
|
+
|
|
768
|
+
1. Significantly re-did String#csv_split.
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
0.3.5: More testing with other files. I've found that String#csv_split screws up when a line has nothing but gaps in the columns, like ",,"...",," and never has "," anywhere.
|
|
772
|
+
|
|
773
|
+
1. More testing with other files. I've found that String#csv_split screws up when a line has nothing but gaps in the columns, like ",,"...",," and never has "," anywhere.
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
0.3.4: Turned off debugging.
|
|
777
|
+
|
|
778
|
+
1. Turned off debugging.
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
0.3.3
|
|
782
|
+
|
|
783
|
+
1. Created #each.
|
|
784
|
+
2. It's stuffing up for some reason, so I've created $debug and turned all of what was or was going to be #debug into 'if $debug'.
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
0.3.2: Removed all the debugging output.
|
|
788
|
+
|
|
789
|
+
1. Removed all the debugging output.
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
0.3.1
|
|
793
|
+
|
|
794
|
+
1. It doesn't deal with trailing commas (when the last column, but not last columns I think; only the last column) and inserts that and the last quote into the output... Either I will simply truncate both end quotes and end quotes and trailing commas, or I'll remove them prior to doing the tidy-up of the first and last columns.
|
|
795
|
+
2. So, for now I've tacked on some more subs in #csv_split.
|
|
796
|
+
3. Oh right. So, windscreens_&_repairs.email.vic.20061109.csv wasn't the first csv file anymore because I what? Oh yeah, output 0.csv... Modified 1.rb test runner accordingly.
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
## 20061130
|
|
800
|
+
|
|
801
|
+
0.3.0
|
|
802
|
+
|
|
803
|
+
1. Modified String#csv_split to cope with two or more commas together (when there is no data in that column or columns) by /result/test_split/ and then applying a gsub to the string/self prior to reapplying the same split as for test_split. Otherwise I could leave it as is!
|
|
804
|
+
2. Forgot to cope with the fact that result is no longer being generated at the start of csv_split and so when a file has non-quoted columns, then there's nothing there. I knew that I'd need the quote = :none line again!
|
|
805
|
+
|
|
806
|
+
0.2.2
|
|
807
|
+
|
|
808
|
+
1. - test/2.txt
|
|
809
|
+
2. + test/3.txt
|
|
810
|
+
3. + test/windscreens_&_repairs.email.vic.20061109.csv
|
|
811
|
+
4. ~ test/test.rb
|
|
812
|
+
|
|
813
|
+
0.2.2
|
|
814
|
+
|
|
815
|
+
1. I modified #read so as it would cope with being presented with an Array of desired columns, rather than simply with a list of parameters.
|
|
816
|
+
2. Tested that it would work OK as it should have prior to when I made the modification to #read. And it does.
|
|
817
|
+
|
|
818
|
+
0.2.1
|
|
819
|
+
|
|
820
|
+
1. Do some more testing on field selection.
|
|
821
|
+
2. /parse/parse_line/. Being simply parse implies that it is parsing the whole file.
|
|
822
|
+
3. Added method parse. This could be superfluous crap, but there it is for now at least.
|
|
823
|
+
|
|
824
|
+
0.2.0
|
|
825
|
+
|
|
826
|
+
1. /from_csv/parse/.
|
|
827
|
+
2. /lines/rows/ only because I'm using the term columns and it seems to fit in with that better---although columns are the column names, not the column values. I'm not committed to it and may change this back.
|
|
828
|
+
3. Added < File to the CSVFile class definition.
|
|
829
|
+
4. /@file_handle/self/.
|
|
830
|
+
5. I decided to only use the term rows to designate parsed data and so is essentially restricted to @rows and related.
|
|
831
|
+
6. /lines/rows/. I changed it back again, because lines seems more natural. Still not sure about this, but so as to accommodat rows, I'm providing a rows method which returns @lines.
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
## 20061123
|
|
835
|
+
|
|
836
|
+
0.1.1
|
|
837
|
+
|
|
838
|
+
1. Added an additional conditional to String#csv_split, so as to close Todo#12; which I just put in---the asterisk is off already!
|
|
839
|
+
2. Fixed an unencountered problem with String#csv_split, which would have caused some headaches for sure: the regexes had the spaces after the second quote, when they should have been between the command the second quote. Another 'Doh!'.
|
|
840
|
+
3. Took out the quote = :none line from String#csv_split since this isn't needed.
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
0.1.0
|
|
844
|
+
|
|
845
|
+
1. /csv2to/csv_file.rb/
|
|
846
|
+
2. ~ lib/csv_file.rb: - require 'pp'
|
|
847
|
+
3. ~ lib/csv_file.rb: ~ read()
|
|
848
|
+
4. - csv2to.rb
|
|
849
|
+
5. - test.csv
|
|
850
|
+
6. - test.txt
|
|
851
|
+
7. + lib/csv_file.rb
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
## 20061122
|
|
855
|
+
|
|
856
|
+
0.0.15: Removed any remaining debugging stuff, since I'm reasonably happy with this for a 0.0 final version.
|
|
857
|
+
|
|
858
|
+
1. Removed any remaining debugging stuff, since I'm reasonably happy with this for a 0.0 final version.
|
|
859
|
+
|
|
860
|
+
0.0.14
|
|
861
|
+
|
|
862
|
+
1. Simplified #read even further by replacing the full @columns by just the key when loading up the desired_columns variable. (Started this in 0.0.13, but decided to tread lightly!)
|
|
863
|
+
2. A redundant return was removed from String#csv_split.
|
|
864
|
+
|
|
865
|
+
0.0.13
|
|
866
|
+
|
|
867
|
+
1. Simplified #read further for when there are no column names.
|
|
868
|
+
2. Modified #columns= to use the (i += 1) thingy.
|
|
869
|
+
|
|
870
|
+
0.0.12: Tried to simplify #read some by not having an extra case statement and by combining desired_columns and @columns some.
|
|
871
|
+
|
|
872
|
+
1. Tried to simplify #read some by not having an extra case statement and by combining desired_columns and @columns some.
|
|
873
|
+
|
|
874
|
+
0.0.11
|
|
875
|
+
|
|
876
|
+
1. String#cvs_split now only removes leading and trailing quotes, rather than removing all remaining quotes, and leaves alone any other quotes which are not involved in delimitation.
|
|
877
|
+
2. Removed a bit of debugging stuff.
|
|
878
|
+
3. Removed the columns_defined stuff from #read, since it really wasn't necessary.
|
|
879
|
+
|
|
880
|
+
0.0.10
|
|
881
|
+
|
|
882
|
+
1. I did that little (i += 1) trick in #columns. Had to change the initial value to -1 though, of course.
|
|
883
|
+
2. CSVFile now copes with unspecified column names. I've roughly doubled the size of #read however. It might be more efficient to do the branching elsewhere than inside the the loop there too...
|
|
884
|
+
3. Made #first_line as idempotent as possible, insofar as it does a rewind after it grabs the first line. Ideally it would take note of the current line number and then restore that. I'll put that in the todo list...
|
|
885
|
+
4. Stopped using @file_handle.lineno, since it seemed to do nothing and substituted using #rewind and gets instead.
|
|
886
|
+
|
|
887
|
+
0.0.9
|
|
888
|
+
|
|
889
|
+
1. #columns= now accepts what I really wanted and that was a simple list, which becomes an array; without any asterisks either!?... It still accepts hashes and arrays as well.
|
|
890
|
+
2. I changed all references to to_s to to_sym, but that wasn't working so I changed it back. The keys as symbols, as per Todo#7 will have to wait!
|
|
891
|
+
3. I tested putting a comma into the test.csv and it worked fine. I haven't fully tested all the different sorts of CSV, but I'm pretty sure it will work OK. And it is *very* tolerant of different CSV formats. Even to the extent of each line being different! It also will cope will with variable gaps between commas.
|
|
892
|
+
|
|
893
|
+
0.0.8: #columns= now accepts hashes again.
|
|
894
|
+
|
|
895
|
+
1. #columns= now accepts hashes again.
|
|
896
|
+
|
|
897
|
+
0.0.7: #columns= now accepts an array, which is preferable since the column order is implicit in the order in which it is provided to the function, rather than so laboriously making it explicit with hashes.
|
|
898
|
+
|
|
899
|
+
1. #columns= now accepts an array, which is preferable since the column order is implicit in the order in which it is provided to the function, rather than so laboriously making it explicit with hashes.
|
|
900
|
+
|
|
901
|
+
0.0.6: Added a quote variable and a case statement to String#csv_split so as to remove Bug#3.
|
|
902
|
+
|
|
903
|
+
1. Added a quote variable and a case statement to String#csv_split so as to remove Bug#3.
|
|
904
|
+
|
|
905
|
+
0.0.5
|
|
906
|
+
|
|
907
|
+
1. Changed @headers and #headers to @columns and #columns.
|
|
908
|
+
2. Had to change columns in #read to desired_columns to accommodate Change#10.
|
|
909
|
+
3. Added columns as an attribute writer, so as when there isn't a header line, that same information can be programmatically 'dropped in'. CSVFile should still be able to work even if there is no header line and no columns specified in this way. I've added this as Todo#3.
|
|
910
|
+
4. Created String#csv_split, so as it will solve Bug#2. I was going to create this initially as a method in CSVFile, but wanted to stay really OO by having this message be able to be sent to strings. See Todo#2 for (possibly) a better way.
|
|
911
|
+
5. Swapped out the inline CSV splitting stuff in #columns and #from_csv for the new String#csv_split method. So much cleaner!
|
|
912
|
+
6. Added a chomp into String#csv_split, since the last element still had the linefeed attached.
|
|
913
|
+
7. Forgot to change an instance of columns to desired_columns in #read! Oh, so that's why!
|
|
914
|
+
8. Removed attr_writer :columns and replaced it with def columns= so as to control the internal representation of the columns instance variable better. This is so as to cope with being able to define column hash keys using either symbols or strings. It will also come in handy if I make the parameter to #columns= be able to be an array somehow... See Todo#4.
|
|
915
|
+
|
|
916
|
+
0.0.4
|
|
917
|
+
|
|
918
|
+
1. Changed the split parameters throughout to use a more sophisticated regex which removes any trailing spaces after a comma and consequently removed the gsubs which makes for simpler code.
|
|
919
|
+
2. Added a gsub to the same splitter lines to cope with quoted CSV files. It doesn't cope with commas between quotes however! See Bugs#2.
|
|
920
|
+
3. Added a collect to the splitter in #headers, since I'm operating on the whole array here.
|
|
921
|
+
4. Added a variable field in to #from_csv to cope with the test for whether to apply a gsub, since some fields are empty.
|
|
922
|
+
5. Changed the modification of a header from compressing the name by removing spaces and instead replacing spaces with underscores.
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
0.0.3: Added a to_s into #from_csv, so as one can call the read method using symbols.
|
|
926
|
+
|
|
927
|
+
1. Added a to_s into #from_csv, so as one can call the read method using symbols.
|
|
928
|
+
|
|
929
|
+
0.0.2
|
|
930
|
+
|
|
931
|
+
1. I've changed the interface to read to accept an array as separate parameters rather than as a single parameter now.
|
|
932
|
+
2. So as to still be able to cope with the default of selecting all columns, I've altered the case statement which checks as to whether any columns have been specified (Is columns an empty array?), since Ruby disallows *-style parameters from having defaults.
|
|
933
|
+
|
|
934
|
+
0.0.1
|
|
935
|
+
|
|
936
|
+
1. ~ csv2to.rb: ~ read()
|
|
937
|
+
2. ~ csv2to.rb
|
|
938
|
+
3. ~ test.txt
|
|
939
|
+
|
|
940
|
+
0.0.0: + csv2to.rb, test.csv, test.txt
|
|
941
|
+
|
|
942
|
+
1. ~ csv2to.rb: + require 'pp'
|
|
943
|
+
2. ~ csv2to.rb: + class CSVFile
|
|
944
|
+
3. ~ csv2to.rb: + initialize()
|
|
945
|
+
4. ~ csv2to.rb: + read()
|
|
946
|
+
5. ~ csv2to.rb: + first_line()
|
|
947
|
+
6. ~ csv2to.rb: + headers()
|
|
948
|
+
7. ~ csv2to.rb: + from_csv()
|
|
949
|
+
8. + csv2to.rb
|
|
950
|
+
9. + test.csv
|
|
951
|
+
10. + test.txt
|