creek 1.1 → 1.1.1
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 +4 -4
- data/lib/creek/book.rb +5 -2
- data/lib/creek/sheet.rb +3 -3
- data/lib/creek/version.rb +1 -1
- 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: 144f13f0eba1b81962017976302f6b2db2b47b60
|
4
|
+
data.tar.gz: fa8fe5d9aecd0eab818f06027425a0bd28a15808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae590ddf3d095381c2cde2109b90bd1b44637120bcbc24257325fa3283cae6f5fcf35f75778f7b425556bc6c9aeff3c897c018c91f3726e66004d9a56d1b510
|
7
|
+
data.tar.gz: 2f7abb6a3889bbf25fe78165244ed62e265a60b4ea4a3d598a6c0865c8188d4037d281b93c1069f694dcac3ec14c4bcd5765bc0cd1469247adeb714dc6c55e68
|
data/lib/creek/book.rb
CHANGED
@@ -22,8 +22,11 @@ module Creek
|
|
22
22
|
def sheets
|
23
23
|
doc = @files.file.open "xl/workbook.xml"
|
24
24
|
xml = Nokogiri::XML::Document.parse doc
|
25
|
-
|
26
|
-
|
25
|
+
rels_doc = @files.file.open "xl/_rels/workbook.xml.rels"
|
26
|
+
rels = Nokogiri::XML::Document.parse(rels_doc).css("Relationship")
|
27
|
+
@sheets = xml.css('sheet').map do |sheet|
|
28
|
+
sheetfile = rels.find { |el| sheet.attr("r:id") == el.attr("Id") }.attr("Target")
|
29
|
+
Sheet.new(self, sheet.attr("name"), sheet.attr("sheetid"), sheet.attr("state"), sheet.attr("visible"), sheet.attr("r:id"), sheetfile)
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
data/lib/creek/sheet.rb
CHANGED
@@ -13,14 +13,14 @@ module Creek
|
|
13
13
|
:index
|
14
14
|
|
15
15
|
|
16
|
-
def initialize book, name, sheetid, state, visible, rid,
|
16
|
+
def initialize book, name, sheetid, state, visible, rid, sheetfile
|
17
17
|
@book = book
|
18
18
|
@name = name
|
19
19
|
@sheetid = sheetid
|
20
20
|
@visible = visible
|
21
21
|
@rid = rid
|
22
22
|
@state = state
|
23
|
-
@
|
23
|
+
@sheetfile = sheetfile
|
24
24
|
|
25
25
|
# An XLS file has only 256 columns, however, an XLSX or XLSM file can contain up to 16384 columns.
|
26
26
|
# This function creates a hash with all valid XLSX column names and associated indices.
|
@@ -57,7 +57,7 @@ module Creek
|
|
57
57
|
# Returns a hash per row that includes the cell ids and values.
|
58
58
|
# Empty cells will be also included in the hash with a nil value.
|
59
59
|
def rows_generator include_meta_data=false
|
60
|
-
path = "xl
|
60
|
+
path = "xl/#{@sheetfile}"
|
61
61
|
if @book.files.file.exist?(path)
|
62
62
|
# SAX parsing, Each element in the stream comes through as two events:
|
63
63
|
# one to open the element and one to close it.
|
data/lib/creek/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: creek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pythonicrubyist
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.4.
|
152
|
+
rubygems_version: 2.4.8
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: A Ruby gem for parsing large Excel(xlsx and xlsm) files.
|