xsv 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +10 -0
- data/lib/xsv/helpers.rb +1 -1
- data/lib/xsv/sheet.rb +4 -2
- data/lib/xsv/sheet_rows_handler.rb +4 -5
- data/lib/xsv/version.rb +1 -1
- data/xsv.gemspec +4 -3
- metadata +11 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e03874b3017fd111c7b63d68bb2273f406cab5e129b4edb174c2710aed0cbab9
|
4
|
+
data.tar.gz: 39ebe2ffdc657efd737f62026d9cc18a531262f4722189f3d2a3012a1e0885d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95e8ea84b5a39cb1158f7f1a8eb531f00f76d94eacfa370d74080b943f213dbf6d5aa9df237b54896769f4ff9e3a0a1a1393863d832e6b9cf2ceb21e2069d711
|
7
|
+
data.tar.gz: 9b0392cebd9f720d0c716a99f8a179a4def088e90ed79721c40fdecba518365e1e23f8fb82bbf41dbb474329d44414b1742d375a44388a2fc56cd074c870b2f3
|
data/.github/workflows/ruby.yml
CHANGED
@@ -19,7 +19,7 @@ jobs:
|
|
19
19
|
runs-on: ubuntu-latest
|
20
20
|
strategy:
|
21
21
|
matrix:
|
22
|
-
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', 'jruby', 'truffleruby']
|
22
|
+
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', 'jruby', 'truffleruby']
|
23
23
|
|
24
24
|
steps:
|
25
25
|
- uses: actions/checkout@v3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Xsv Changelog
|
2
2
|
|
3
|
+
## 1.3.2 2024-12-25
|
4
|
+
|
5
|
+
- Xsv is now compatbile with Ruby 2.7 through 3.4, latest JRuby, and latest TruffleRuby
|
6
|
+
- Sheet#each_row returns Enumerator when no block is given (thanks @myabc)
|
7
|
+
|
8
|
+
## 1.3.1 2024-05-06
|
9
|
+
|
10
|
+
- Fix issue #56 with multiple nil headers
|
11
|
+
- Ignore colums with a `nil` header in hash mode
|
12
|
+
|
3
13
|
## 1.3.0 2023-12-16
|
4
14
|
|
5
15
|
- 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/helpers.rb
CHANGED
data/lib/xsv/sheet.rb
CHANGED
@@ -55,8 +55,10 @@ module Xsv
|
|
55
55
|
|
56
56
|
# Iterate over rows, returning either hashes or arrays based on the current mode.
|
57
57
|
def each_row(&block)
|
58
|
+
return to_enum(__method__) unless block
|
59
|
+
|
58
60
|
@io.rewind
|
59
|
-
SheetRowsHandler.new(@mode, empty_row, @workbook, @row_skip, @last_row, &block).parse(@io)
|
61
|
+
SheetRowsHandler.new(@mode, @headers, empty_row, @workbook, @row_skip, @last_row, &block).parse(@io)
|
60
62
|
true
|
61
63
|
end
|
62
64
|
|
@@ -114,7 +116,7 @@ module Xsv
|
|
114
116
|
when :array
|
115
117
|
[nil] * @column_count
|
116
118
|
when :hash
|
117
|
-
@headers.zip([]).to_h
|
119
|
+
@headers.compact.zip([]).to_h
|
118
120
|
end
|
119
121
|
end
|
120
122
|
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
data/xsv.gemspec
CHANGED
@@ -41,7 +41,8 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.add_dependency "rubyzip", ">= 1.3", "< 3"
|
42
42
|
|
43
43
|
spec.add_development_dependency "bundler", "< 3"
|
44
|
-
spec.add_development_dependency "rake", "~> 13.
|
45
|
-
spec.add_development_dependency "minitest", "~> 5.
|
46
|
-
|
44
|
+
spec.add_development_dependency "rake", "~> 13.2"
|
45
|
+
spec.add_development_dependency "minitest", "~> 5.24"
|
46
|
+
# Maintain Ruby 2.7 compatibility
|
47
|
+
spec.add_development_dependency "standard", "1.37.0"
|
47
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martijn Storck
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-12-25 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rubyzip
|
@@ -50,42 +49,42 @@ dependencies:
|
|
50
49
|
requirements:
|
51
50
|
- - "~>"
|
52
51
|
- !ruby/object:Gem::Version
|
53
|
-
version: 13.
|
52
|
+
version: '13.2'
|
54
53
|
type: :development
|
55
54
|
prerelease: false
|
56
55
|
version_requirements: !ruby/object:Gem::Requirement
|
57
56
|
requirements:
|
58
57
|
- - "~>"
|
59
58
|
- !ruby/object:Gem::Version
|
60
|
-
version: 13.
|
59
|
+
version: '13.2'
|
61
60
|
- !ruby/object:Gem::Dependency
|
62
61
|
name: minitest
|
63
62
|
requirement: !ruby/object:Gem::Requirement
|
64
63
|
requirements:
|
65
64
|
- - "~>"
|
66
65
|
- !ruby/object:Gem::Version
|
67
|
-
version: 5.
|
66
|
+
version: '5.24'
|
68
67
|
type: :development
|
69
68
|
prerelease: false
|
70
69
|
version_requirements: !ruby/object:Gem::Requirement
|
71
70
|
requirements:
|
72
71
|
- - "~>"
|
73
72
|
- !ruby/object:Gem::Version
|
74
|
-
version: 5.
|
73
|
+
version: '5.24'
|
75
74
|
- !ruby/object:Gem::Dependency
|
76
75
|
name: standard
|
77
76
|
requirement: !ruby/object:Gem::Requirement
|
78
77
|
requirements:
|
79
|
-
- -
|
78
|
+
- - '='
|
80
79
|
- !ruby/object:Gem::Version
|
81
|
-
version: 1.
|
80
|
+
version: 1.37.0
|
82
81
|
type: :development
|
83
82
|
prerelease: false
|
84
83
|
version_requirements: !ruby/object:Gem::Requirement
|
85
84
|
requirements:
|
86
|
-
- -
|
85
|
+
- - '='
|
87
86
|
- !ruby/object:Gem::Version
|
88
|
-
version: 1.
|
87
|
+
version: 1.37.0
|
89
88
|
description: |2
|
90
89
|
Xsv is a fast, lightweight parser for Office Open XML spreadsheet files
|
91
90
|
(commonly known as Excel or .xlsx files). It strives to be minimal in the
|
@@ -128,7 +127,6 @@ metadata:
|
|
128
127
|
homepage_uri: https://github.com/martijn/xsv
|
129
128
|
source_code_uri: https://github.com/martijn/xsv
|
130
129
|
changelog_uri: https://raw.githubusercontent.com/martijn/xsv/main/CHANGELOG.md
|
131
|
-
post_install_message:
|
132
130
|
rdoc_options: []
|
133
131
|
require_paths:
|
134
132
|
- lib
|
@@ -143,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
141
|
- !ruby/object:Gem::Version
|
144
142
|
version: '0'
|
145
143
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
144
|
+
rubygems_version: 3.6.2
|
148
145
|
specification_version: 4
|
149
146
|
summary: A fast and lightweight xlsx parser that provides nothing a CSV parser wouldn't
|
150
147
|
test_files: []
|