saxlsx 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -7
- data/README.md +14 -14
- data/Rakefile +0 -1
- data/lib/saxlsx.rb +1 -0
- data/lib/saxlsx/boolean_parser.rb +2 -1
- data/lib/saxlsx/column_name_generator.rb +2 -1
- data/lib/saxlsx/file_system.rb +10 -3
- data/lib/saxlsx/rows_collection.rb +1 -0
- data/lib/saxlsx/rows_collection_parser.rb +1 -0
- data/lib/saxlsx/sax_parser.rb +2 -1
- data/lib/saxlsx/shared_string_collection.rb +2 -1
- data/lib/saxlsx/shared_string_collection_parser.rb +3 -2
- data/lib/saxlsx/sheet.rb +2 -1
- data/lib/saxlsx/sheet_collection.rb +2 -1
- data/lib/saxlsx/sheet_collection_parser.rb +2 -1
- data/lib/saxlsx/style_collection.rb +2 -1
- data/lib/saxlsx/style_collection_parser.rb +2 -1
- data/lib/saxlsx/version.rb +2 -1
- data/lib/saxlsx/workbook.rb +3 -2
- data/spec/benchmarks.rb +1 -0
- data/spec/column_name_generator_spec.rb +2 -1
- data/spec/sheet_spec.rb +1 -0
- data/spec/spec_helper.rb +2 -1
- data/spec/workbook_spec.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bc6b0c27db86c92575ab6d76e938718f987062b
|
4
|
+
data.tar.gz: d64e2b1bf4fad6173b4e6a6fdcc9f52af0b67be7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d06a5f4ea511da6bc470d3ab7129dd63d0876de0f1470a8f0ef9ced9c4611dd9f0d0d6c2d6b8ff07e20ecb4d7e918bd2849ce4ccff3c854e001748cbcf51f691
|
7
|
+
data.tar.gz: c2e9c81ddc0ce05477f60d720eba7bf5b23f9afb37c9b75f69e779d9e4f1f185ac46b2da579fe3cb29d879eb3f6d8b9060d0539357238cbd2873dbad4f63a737
|
data/Gemfile
CHANGED
@@ -3,10 +3,10 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in saxlsx.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'axlsx',
|
7
|
-
gem 'rubyXL'
|
8
|
-
gem 'simple_xlsx_reader'
|
9
|
-
gem 'creek'
|
10
|
-
gem 'oxcelix'
|
11
|
-
gem 'roo'
|
12
|
-
gem 'dullard'
|
6
|
+
gem 'axlsx', github: 'randym/axlsx'
|
7
|
+
gem 'rubyXL', github: 'weshatheleopard/rubyXL'
|
8
|
+
gem 'simple_xlsx_reader', github: 'woahdae/simple_xlsx_reader'
|
9
|
+
gem 'creek', github: 'pythonicrubyist/creek'
|
10
|
+
gem 'oxcelix', github: 'gbiczo/oxcelix'
|
11
|
+
gem 'roo', github: 'roo-rb/roo'
|
12
|
+
gem 'dullard', github: 'thirtyseven/dullard'
|
data/README.md
CHANGED
@@ -52,30 +52,30 @@ using `auto_format: false`.
|
|
52
52
|
$ rake bench
|
53
53
|
```
|
54
54
|
|
55
|
-
ruby 2.
|
55
|
+
ruby 2.4.1 on OS X 10.12
|
56
56
|
|
57
57
|
```
|
58
58
|
Shared Strings
|
59
59
|
|
60
60
|
user system total real
|
61
|
-
creek
|
62
|
-
dullard
|
63
|
-
oxcelix 1.100000 0.
|
64
|
-
roo
|
65
|
-
rubyXL 3.
|
66
|
-
saxlsx 0.
|
67
|
-
simple_xlsx_reader 1.
|
61
|
+
creek 2.310000 0.040000 2.350000 ( 2.414795)
|
62
|
+
dullard 1.660000 0.050000 1.710000 ( 1.753160)
|
63
|
+
oxcelix 1.100000 0.060000 1.160000 ( 1.169371)
|
64
|
+
roo 2.770000 0.120000 2.890000 ( 2.943509)
|
65
|
+
rubyXL 3.570000 0.090000 3.660000 ( 3.716661)
|
66
|
+
saxlsx 0.620000 0.040000 0.660000 ( 0.665471)
|
67
|
+
simple_xlsx_reader 1.590000 0.030000 1.620000 ( 1.643398)
|
68
68
|
|
69
69
|
Inline Strings
|
70
70
|
|
71
71
|
user system total real
|
72
|
-
creek 2.
|
73
|
-
dullard 2.
|
72
|
+
creek 2.840000 0.200000 3.040000 ( 3.335055)
|
73
|
+
dullard 2.200000 0.250000 2.450000 ( 2.613793)
|
74
74
|
oxcelix ERROR
|
75
|
-
roo
|
76
|
-
rubyXL
|
77
|
-
saxlsx 0.
|
78
|
-
simple_xlsx_reader 1.
|
75
|
+
roo 3.550000 0.160000 3.710000 ( 3.749528)
|
76
|
+
rubyXL 3.890000 0.390000 4.280000 ( 4.340749)
|
77
|
+
saxlsx 0.930000 0.240000 1.170000 ( 1.173783)
|
78
|
+
simple_xlsx_reader 1.760000 0.040000 1.800000 ( 1.818311)
|
79
79
|
```
|
80
80
|
|
81
81
|
## Contributing
|
data/Rakefile
CHANGED
data/lib/saxlsx.rb
CHANGED
data/lib/saxlsx/file_system.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Saxlsx
|
2
3
|
class FileSystem
|
4
|
+
IO_METHODS = [:tell, :seek, :read, :close]
|
3
5
|
|
4
6
|
def self.open(filename)
|
5
7
|
begin
|
@@ -11,11 +13,16 @@ module Saxlsx
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def initialize(filename)
|
14
|
-
|
16
|
+
if IO_METHODS.map { |method| filename.respond_to?(method) }.all?
|
17
|
+
@zip = Zip::File.open_buffer filename
|
18
|
+
@io = true
|
19
|
+
else
|
20
|
+
@zip = Zip::File.open filename
|
21
|
+
end
|
15
22
|
end
|
16
23
|
|
17
24
|
def close
|
18
|
-
@zip.close
|
25
|
+
@zip.close unless @io
|
19
26
|
end
|
20
27
|
|
21
28
|
def workbook
|
@@ -36,4 +43,4 @@ module Saxlsx
|
|
36
43
|
end
|
37
44
|
|
38
45
|
end
|
39
|
-
end
|
46
|
+
end
|
data/lib/saxlsx/sax_parser.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Saxlsx
|
2
3
|
class SharedStringCollectionParser < Ox::Sax
|
3
4
|
|
@@ -26,8 +27,8 @@ module Saxlsx
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def text(value)
|
29
|
-
@current_string
|
30
|
+
@current_string = CGI.unescapeHTML(value) if @current_string
|
30
31
|
end
|
31
32
|
|
32
33
|
end
|
33
|
-
end
|
34
|
+
end
|
data/lib/saxlsx/sheet.rb
CHANGED
data/lib/saxlsx/version.rb
CHANGED
data/lib/saxlsx/workbook.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Saxlsx
|
2
3
|
class Workbook
|
3
4
|
DATE_SYSTEM_1900 = DateTime.new(1899, 12, 30)
|
@@ -11,7 +12,7 @@ module Saxlsx
|
|
11
12
|
workbook = self.new(*args)
|
12
13
|
yield workbook
|
13
14
|
ensure
|
14
|
-
workbook.close
|
15
|
+
workbook.close if workbook
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -50,4 +51,4 @@ module Saxlsx
|
|
50
51
|
end
|
51
52
|
|
52
53
|
end
|
53
|
-
end
|
54
|
+
end
|
data/spec/benchmarks.rb
CHANGED
data/spec/sheet_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/workbook_spec.rb
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Workbook do
|
4
5
|
|
5
6
|
let(:filename) { "#{File.dirname(__FILE__)}/data/Spec.xlsx" }
|
6
7
|
|
8
|
+
it 'Reads from StringIO' do
|
9
|
+
io = StringIO.new File.read(filename)
|
10
|
+
Workbook.open io do |w|
|
11
|
+
w.should have(5).sheets
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
7
15
|
it 'Sheets count' do
|
8
16
|
Workbook.open filename do |w|
|
9
17
|
w.should have(5).sheets
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saxlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgars Beigarts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
158
|
+
rubygems_version: 2.6.11
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: Fast xlsx reader on top of Ox SAX parser
|