creek 1.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3950b25e2918e737d3cad09864a3afad4044f775
4
- data.tar.gz: b5c9dd6210cdf859ecc74dfe6f06200d2971d4b5
3
+ metadata.gz: 144f13f0eba1b81962017976302f6b2db2b47b60
4
+ data.tar.gz: fa8fe5d9aecd0eab818f06027425a0bd28a15808
5
5
  SHA512:
6
- metadata.gz: 401143686b68b23e43ccb286d6a6cf40f9cb0c0eeb085a5d87e625000358d3fbbc6b0420631da3d62758f0ee512298637df28c909261238df88879ff551c84c8
7
- data.tar.gz: 1d7c66afffeeffdea98924e8ae6e1b2c1ee2dc163d22e8f9a395aa5e411b7bf040ae0f08ba66bf38c5fd478981b85df5b1c324587a0a3c48c43da03d7dc1bd88
6
+ metadata.gz: 6ae590ddf3d095381c2cde2109b90bd1b44637120bcbc24257325fa3283cae6f5fcf35f75778f7b425556bc6c9aeff3c897c018c91f3726e66004d9a56d1b510
7
+ data.tar.gz: 2f7abb6a3889bbf25fe78165244ed62e265a60b4ea4a3d598a6c0865c8188d4037d281b93c1069f694dcac3ec14c4bcd5765bc0cd1469247adeb714dc6c55e68
@@ -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
- @sheets = xml.css('sheet').each_with_index.map do |sheet, i|
26
- Sheet.new(self, sheet.attr("name"), sheet.attr("sheetid"), sheet.attr("state"), sheet.attr("visible"), sheet.attr("r:id"), i+1)
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
 
@@ -13,14 +13,14 @@ module Creek
13
13
  :index
14
14
 
15
15
 
16
- def initialize book, name, sheetid, state, visible, rid, index
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
- @index = index
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/worksheets/sheet#{@index}.xml"
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.
@@ -1,3 +1,3 @@
1
1
  module Creek
2
- VERSION = "1.1"
2
+ VERSION = "1.1.1"
3
3
  end
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: '1.1'
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-09-06 00:00:00.000000000 Z
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.6
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.