xsv 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/xsv/sheet.rb +2 -2
- data/lib/xsv/sheet_rows_handler.rb +4 -5
- data/lib/xsv/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f753b006d8a3c230447e56b70824c7df929c5b7bd074ec82cf82acdf971073c
|
4
|
+
data.tar.gz: bb457169f14d259526443ff2afa47477dceb13edf13d99f089e2f843f9fa258f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3686372d118d3d3ca17c403e34479ab00168f0ba5b2057b624cf0b90ed4ee28caf7f9237201c5f6649a7435adc2b77e29751eeec90a71ec577acfcbca2ff0b2
|
7
|
+
data.tar.gz: '094d7b47e71c7ad96b1a477e672c2615203f814cc475cc6194772e8e048713d36e58780c9dbe17a2239a4a63869eea3cde8cbcc20a7dd07816cde9519ff6a2e7'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Xsv Changelog
|
2
2
|
|
3
|
+
## 1.3.1 2023-05-06
|
4
|
+
|
5
|
+
- Fix issue #56 with multiple nil headers
|
6
|
+
- Ignore colums with a `nil` header in hash mode
|
7
|
+
|
3
8
|
## 1.3.0 2023-12-16
|
4
9
|
|
5
10
|
- Ruby 2.6 is no longer supported. Xsv is compatible with Ruby 2.7 through 3.3, latest JRuby, and latest TruffleRuby
|
data/lib/xsv/sheet.rb
CHANGED
@@ -56,7 +56,7 @@ module Xsv
|
|
56
56
|
# Iterate over rows, returning either hashes or arrays based on the current mode.
|
57
57
|
def each_row(&block)
|
58
58
|
@io.rewind
|
59
|
-
SheetRowsHandler.new(@mode, empty_row, @workbook, @row_skip, @last_row, &block).parse(@io)
|
59
|
+
SheetRowsHandler.new(@mode, @headers, empty_row, @workbook, @row_skip, @last_row, &block).parse(@io)
|
60
60
|
true
|
61
61
|
end
|
62
62
|
|
@@ -114,7 +114,7 @@ module Xsv
|
|
114
114
|
when :array
|
115
115
|
[nil] * @column_count
|
116
116
|
when :hash
|
117
|
-
@headers.zip([]).to_h
|
117
|
+
@headers.compact.zip([]).to_h
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -6,8 +6,9 @@ module Xsv
|
|
6
6
|
class SheetRowsHandler < SaxParser
|
7
7
|
include Xsv::Helpers
|
8
8
|
|
9
|
-
def initialize(mode, empty_row, workbook, row_skip, last_row, &block)
|
9
|
+
def initialize(mode, headers, empty_row, workbook, row_skip, last_row, &block)
|
10
10
|
@mode = mode
|
11
|
+
@headers = headers
|
11
12
|
@empty_row = empty_row
|
12
13
|
@workbook = workbook
|
13
14
|
@row_skip = row_skip
|
@@ -22,8 +23,6 @@ module Xsv
|
|
22
23
|
@current_row_number = 0
|
23
24
|
@current_cell = {}
|
24
25
|
@current_value = +""
|
25
|
-
|
26
|
-
@headers = @empty_row.keys if @mode == :hash
|
27
26
|
end
|
28
27
|
|
29
28
|
def start_element(name, attrs)
|
@@ -34,7 +33,7 @@ module Xsv
|
|
34
33
|
when "v", "is", "t"
|
35
34
|
@store_characters = true
|
36
35
|
when "row"
|
37
|
-
@current_row = @mode == :array ? [] : @empty_row.dup
|
36
|
+
@current_row = (@mode == :array) ? [] : @empty_row.dup
|
38
37
|
@current_row_number = attrs[:r].to_i
|
39
38
|
end
|
40
39
|
end
|
@@ -53,7 +52,7 @@ module Xsv
|
|
53
52
|
if @mode == :array
|
54
53
|
@current_row[col_index] = format_cell
|
55
54
|
else
|
56
|
-
@current_row[@headers[col_index]] = format_cell
|
55
|
+
@current_row[@headers[col_index]] = format_cell unless @headers[col_index].nil?
|
57
56
|
end
|
58
57
|
|
59
58
|
@col_index += 1
|
data/lib/xsv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xsv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martijn Storck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|