xsv 0.3.13 → 0.3.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/CHANGELOG.md +7 -1
- data/Gemfile +1 -1
- data/Rakefile +0 -1
- data/lib/xsv/helpers.rb +2 -2
- data/lib/xsv/shared_strings_parser.rb +1 -1
- data/lib/xsv/styles_handler.rb +2 -2
- data/lib/xsv/version.rb +1 -1
- data/lib/xsv/workbook.rb +5 -5
- data/lib/xsv.rb +2 -1
- data/xsv.gemspec +13 -14
- metadata +2 -3
- data/test.sh +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a66b24ece17f7b9faa5135579c0af4d35304d621e853faca1e6d7d9690b89e6f
|
4
|
+
data.tar.gz: a198c842580d809434a07eca88926f0e3a427aa2c61f94c1cc6b8280f71a69a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccec619995f290348adb91cd5114b1829641e7623bf7715fea9a0de9787451d1393230cd69f225f340c463fcb53b595ca97dabf25cedcebfbc5f985d8bf60afa
|
7
|
+
data.tar.gz: f02eb4ea27c7e87634e11b626f5f7f9b5ad1f4068240428e52864798d08054c795ff78865cb1352a2dedc49d0f0933f51f6f3ac4dd598d72c2e510086d673ddd
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/xsv/helpers.rb
CHANGED
@@ -39,7 +39,7 @@ module Xsv
|
|
39
39
|
|
40
40
|
MINUTE = 60.freeze
|
41
41
|
HOUR = 3600.freeze
|
42
|
-
A_CODEPOINT =
|
42
|
+
A_CODEPOINT = "A".ord.freeze
|
43
43
|
# The epoch for all dates in OOXML Spreadsheet documents
|
44
44
|
EPOCH = Date.new(1899, 12, 30).freeze
|
45
45
|
|
@@ -53,7 +53,7 @@ module Xsv
|
|
53
53
|
|
54
54
|
# Return a Date for the given Excel date value
|
55
55
|
def parse_date(number)
|
56
|
-
|
56
|
+
EPOCH + number
|
57
57
|
end
|
58
58
|
|
59
59
|
# Return a time as a string for the given Excel time value
|
data/lib/xsv/styles_handler.rb
CHANGED
data/lib/xsv/version.rb
CHANGED
data/lib/xsv/workbook.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "zip"
|
3
3
|
|
4
4
|
module Xsv
|
5
5
|
# An OOXML Spreadsheet document is called a Workbook. A Workbook consists of
|
@@ -15,11 +15,11 @@ module Xsv
|
|
15
15
|
# Open the workbook of the given filename, string or buffer. For additional
|
16
16
|
# options see {.initialize}
|
17
17
|
def self.open(data, **kws)
|
18
|
-
if data.is_a?(IO)
|
18
|
+
if data.is_a?(IO) || data.respond_to?(:read) # is it a buffer?
|
19
19
|
@workbook = self.new(Zip::File.open_buffer(data), **kws)
|
20
|
-
elsif data.start_with?("PK\x03\x04")
|
20
|
+
elsif data.start_with?("PK\x03\x04") # is it a string containing a filename?
|
21
21
|
@workbook = self.new(Zip::File.open_buffer(data), **kws)
|
22
|
-
else
|
22
|
+
else # must be a filename
|
23
23
|
@workbook = self.new(Zip::File.open(data), **kws)
|
24
24
|
end
|
25
25
|
end
|
@@ -91,7 +91,7 @@ module Xsv
|
|
91
91
|
@zip.glob("xl/worksheets/sheet*.xml").sort do |a, b|
|
92
92
|
a.name[/\d+/].to_i <=> b.name[/\d+/].to_i
|
93
93
|
end.each do |entry|
|
94
|
-
rel = @relationships.detect { |r| entry.name.end_with?(r[:Target]) && r[:Type].end_with?(
|
94
|
+
rel = @relationships.detect { |r| entry.name.end_with?(r[:Target]) && r[:Type].end_with?("worksheet") }
|
95
95
|
sheet_ids = @sheets_ids.detect { |i| i[:r_id] == rel[:Id] }
|
96
96
|
@sheets << Xsv::Sheet.new(self, entry.get_input_stream, entry.size, sheet_ids)
|
97
97
|
end
|
data/lib/xsv.rb
CHANGED
@@ -8,7 +8,7 @@ require "xsv/shared_strings_parser"
|
|
8
8
|
require "xsv/sheet"
|
9
9
|
require "xsv/sheet_bounds_handler"
|
10
10
|
require "xsv/sheet_rows_handler"
|
11
|
-
require
|
11
|
+
require "xsv/sheets_ids_handler"
|
12
12
|
require "xsv/styles_handler"
|
13
13
|
require "xsv/version"
|
14
14
|
require "xsv/workbook"
|
@@ -19,6 +19,7 @@ require "xsv/workbook"
|
|
19
19
|
# deals with minimal formatting and cannot create or modify documents.
|
20
20
|
module Xsv
|
21
21
|
class Error < StandardError; end
|
22
|
+
|
22
23
|
# An AssertionFailed error indicates an unexpected condition, meaning a bug
|
23
24
|
# or misinterpreted .xlsx document
|
24
25
|
class AssertionFailed < StandardError; end
|
data/xsv.gemspec
CHANGED
@@ -1,23 +1,22 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "xsv/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
6
|
+
spec.name = "xsv"
|
7
|
+
spec.version = Xsv::VERSION
|
8
|
+
spec.authors = ["Martijn Storck"]
|
9
|
+
spec.email = ["martijn@storck.io"]
|
11
10
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
11
|
+
spec.summary = "A fast and lightweiggt xlsx parser that provides nothing a CSV parser wouldn't"
|
12
|
+
spec.description = <<-EOF
|
14
13
|
Xsv is a fast, lightweight parser for Office Open XML spreadsheet files
|
15
14
|
(commonly known as Excel or .xlsx files). It strives to be minimal in the
|
16
15
|
sense that it provides nothing a CSV reader wouldn't, meaning it only
|
17
16
|
deals with minimal formatting and cannot create or modify documents.
|
18
17
|
EOF
|
19
|
-
spec.homepage
|
20
|
-
spec.license
|
18
|
+
spec.homepage = "https://github.com/martijn/xsv"
|
19
|
+
spec.license = "MIT"
|
21
20
|
|
22
21
|
if spec.respond_to?(:metadata)
|
23
22
|
spec.metadata["homepage_uri"] = spec.homepage
|
@@ -25,19 +24,19 @@ Gem::Specification.new do |spec|
|
|
25
24
|
spec.metadata["changelog_uri"] = "https://github.com/martijn/xsv/CHANGELOG.md"
|
26
25
|
else
|
27
26
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
28
|
-
|
27
|
+
"public gem pushes."
|
29
28
|
end
|
30
29
|
|
31
30
|
# Specify which files should be added to the gem when it is released.
|
32
31
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
33
|
-
spec.files
|
32
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
34
33
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
35
34
|
end
|
36
|
-
spec.bindir
|
37
|
-
spec.executables
|
35
|
+
spec.bindir = "exe"
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
37
|
spec.require_paths = ["lib"]
|
39
38
|
|
40
|
-
spec.required_ruby_version =
|
39
|
+
spec.required_ruby_version = "~> 2.5"
|
41
40
|
|
42
41
|
spec.add_dependency "rubyzip", ">= 1.3", "< 3"
|
43
42
|
spec.add_dependency "ox", ">= 2.9"
|
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: 0.3.
|
4
|
+
version: 0.3.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martijn Storck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -117,7 +117,6 @@ files:
|
|
117
117
|
- lib/xsv/styles_handler.rb
|
118
118
|
- lib/xsv/version.rb
|
119
119
|
- lib/xsv/workbook.rb
|
120
|
-
- test.sh
|
121
120
|
- xsv.gemspec
|
122
121
|
homepage: https://github.com/martijn/xsv
|
123
122
|
licenses:
|
data/test.sh
DELETED