creek 2.5.2 → 2.6.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/test.yml +35 -0
- data/creek.gemspec +1 -1
- data/lib/creek/drawing.rb +12 -7
- data/lib/creek/shared_strings.rb +13 -3
- data/lib/creek/sheet.rb +17 -6
- data/lib/creek/styles/converter.rb +1 -1
- data/lib/creek/version.rb +1 -1
- data/spec/drawing_spec.rb +18 -0
- data/spec/fixtures/sample-with-headers_namespaced.xlsx +0 -0
- data/spec/fixtures/sample-with-one-cell-anchored-images.xlsx +0 -0
- data/spec/fixtures/sample_namespaced.xlsx +0 -0
- data/spec/fixtures/sst_namespaced.xml +91 -0
- data/spec/shared_string_spec.rb +18 -1
- data/spec/sheet_spec.rb +68 -2
- metadata +16 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6c8bd9467a3772e8b09ecfce4dbef12d530cc094e44a0a9de3806d92930a46f
|
4
|
+
data.tar.gz: de59455bb37db21574fb55f269dd12faa3c4aeecbb52139ce5fdb6b0a7bb740a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0d5f95b17cd1e3cd7f0fb1286aa6a3a57875949b8a1c55c7eb34e0afe6f9bb34c373126273e5b20f77553c4e350fa8089c0398dfe23c55757a9c43a5ebd141c
|
7
|
+
data.tar.gz: ff1771e65a5add043080fa4ebb63c5b90a4e91d40ee7566996ae9e33a83dc0f6b54d327ee825a5759ee874a7219c4bcd2097b2e78e27374e5c7fc6d69fcccebd
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ "*" ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ "*" ]
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: read
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
strategy:
|
24
|
+
matrix:
|
25
|
+
ruby-version: ['2.6', '2.7', '3.0', '3.1']
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v3
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- name: Run tests
|
35
|
+
run: bundle exec rake
|
data/creek.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.0.0'
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.6.0'
|
26
26
|
spec.add_development_dependency 'pry-byebug'
|
data/lib/creek/drawing.rb
CHANGED
@@ -66,7 +66,7 @@ module Creek
|
|
66
66
|
# Drawing xml contains relationships ID's and coordinates (row, col).
|
67
67
|
# Drawing relationships xml contains images' locations.
|
68
68
|
def load_drawings_and_rels
|
69
|
-
@drawings = parse_xml(@drawing_filepath).css('xdr|twoCellAnchor')
|
69
|
+
@drawings = parse_xml(@drawing_filepath).css('xdr|twoCellAnchor', 'xdr|oneCellAnchor' )
|
70
70
|
drawing_rels_filepath = expand_to_rels_path(@drawing_filepath)
|
71
71
|
@drawings_rels = parse_xml(drawing_rels_filepath).css('Relationships')
|
72
72
|
end
|
@@ -82,7 +82,7 @@ module Creek
|
|
82
82
|
col_from_selector = 'xdr:from/xdr:col'.freeze
|
83
83
|
col_to_selector = 'xdr:to/xdr:col'.freeze
|
84
84
|
|
85
|
-
@drawings.xpath('//xdr:twoCellAnchor').each do |drawing|
|
85
|
+
@drawings.xpath('//xdr:twoCellAnchor', '//xdr:oneCellAnchor').each do |drawing|
|
86
86
|
# embed = drawing.xpath(image_selector).first.attributes['embed']
|
87
87
|
temp = drawing.xpath(image_selector).first
|
88
88
|
embed = temp.attributes['embed'] if temp
|
@@ -93,12 +93,17 @@ module Creek
|
|
93
93
|
|
94
94
|
row_from = drawing.xpath(row_from_selector).text.to_i
|
95
95
|
col_from = drawing.xpath(col_from_selector).text.to_i
|
96
|
-
row_to = drawing.xpath(row_to_selector).text.to_i
|
97
|
-
col_to = drawing.xpath(col_to_selector).text.to_i
|
98
96
|
|
99
|
-
|
100
|
-
|
101
|
-
|
97
|
+
if drawing.name == 'oneCellAnchor'
|
98
|
+
@images_pathnames[[row_from , col_from ]].push(path)
|
99
|
+
else
|
100
|
+
row_to = drawing.xpath(row_to_selector).text.to_i
|
101
|
+
col_to = drawing.xpath(col_to_selector).text.to_i
|
102
|
+
|
103
|
+
(col_from..col_to).each do |col|
|
104
|
+
(row_from..row_to).each do |row|
|
105
|
+
@images_pathnames[[row, col]].push(path)
|
106
|
+
end
|
102
107
|
end
|
103
108
|
end
|
104
109
|
end
|
data/lib/creek/shared_strings.rb
CHANGED
@@ -5,6 +5,8 @@ module Creek
|
|
5
5
|
|
6
6
|
class Creek::SharedStrings
|
7
7
|
|
8
|
+
SPREADSHEETML_URI = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'
|
9
|
+
|
8
10
|
attr_reader :book, :dictionary
|
9
11
|
|
10
12
|
def initialize book
|
@@ -27,9 +29,17 @@ module Creek
|
|
27
29
|
|
28
30
|
def self.parse_shared_string_from_document(xml)
|
29
31
|
dictionary = Hash.new
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
namespace = xml.namespaces.detect{|_key, uri| uri == SPREADSHEETML_URI }
|
33
|
+
prefix = if namespace && namespace[0].start_with?('xmlns:')
|
34
|
+
namespace[0].delete_prefix('xmlns:') + '|'
|
35
|
+
else
|
36
|
+
''
|
37
|
+
end
|
38
|
+
node_selector = "#{prefix}si"
|
39
|
+
text_selector = ">#{prefix}t, #{prefix}r #{prefix}t"
|
40
|
+
|
41
|
+
xml.css(node_selector).each_with_index do |si, idx|
|
42
|
+
text_nodes = si.css(text_selector)
|
33
43
|
if text_nodes.count == 1 # plain text node
|
34
44
|
dictionary[idx] = Creek::Styles::Converter.unescape_string(text_nodes.first.content)
|
35
45
|
else # rich text nodes with text fragments
|
data/lib/creek/sheet.rb
CHANGED
@@ -8,6 +8,7 @@ module Creek
|
|
8
8
|
include Creek::Utils
|
9
9
|
|
10
10
|
HEADERS_ROW_NUMBER = '1'
|
11
|
+
SPREADSHEETML_URI = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'
|
11
12
|
|
12
13
|
attr_accessor :with_headers
|
13
14
|
attr_reader :book,
|
@@ -92,19 +93,29 @@ module Creek
|
|
92
93
|
opener = Nokogiri::XML::Reader::TYPE_ELEMENT
|
93
94
|
closer = Nokogiri::XML::Reader::TYPE_END_ELEMENT
|
94
95
|
Enumerator.new do |y|
|
96
|
+
@headers = nil
|
95
97
|
row, cells, cell = nil, {}, nil
|
96
98
|
cell_type = nil
|
97
99
|
cell_style_idx = nil
|
98
100
|
@book.files.file.open(path) do |xml|
|
101
|
+
prefix = ''
|
99
102
|
Nokogiri::XML::Reader.from_io(xml).each do |node|
|
100
|
-
if
|
103
|
+
if prefix.empty? && node.namespaces.any?
|
104
|
+
namespace = node.namespaces.detect{|_key, uri| uri == SPREADSHEETML_URI }
|
105
|
+
prefix = if namespace && namespace[0].start_with?('xmlns:')
|
106
|
+
namespace[0].delete_prefix('xmlns:') + ':'
|
107
|
+
else
|
108
|
+
''
|
109
|
+
end
|
110
|
+
end
|
111
|
+
if node.name == "#{prefix}row" && node.node_type == opener
|
101
112
|
row = node.attributes
|
102
113
|
row['cells'] = {}
|
103
114
|
cells = {}
|
104
115
|
y << (include_meta_data ? row : cells) if node.self_closing?
|
105
|
-
elsif node.name ==
|
116
|
+
elsif node.name == "#{prefix}row" && node.node_type == closer
|
106
117
|
processed_cells = fill_in_empty_cells(cells, row['r'], cell, use_simple_rows_format)
|
107
|
-
@headers = processed_cells if row['r'] == HEADERS_ROW_NUMBER
|
118
|
+
@headers = processed_cells if with_headers && row['r'] == HEADERS_ROW_NUMBER
|
108
119
|
|
109
120
|
if @images_present
|
110
121
|
processed_cells.each do |cell_name, cell_value|
|
@@ -116,11 +127,11 @@ module Creek
|
|
116
127
|
|
117
128
|
row['cells'] = processed_cells
|
118
129
|
y << (include_meta_data ? row : processed_cells)
|
119
|
-
elsif node.name ==
|
130
|
+
elsif node.name == "#{prefix}c" && node.node_type == opener
|
120
131
|
cell_type = node.attributes['t']
|
121
132
|
cell_style_idx = node.attributes['s']
|
122
133
|
cell = node.attributes['r']
|
123
|
-
elsif
|
134
|
+
elsif ["#{prefix}v", "#{prefix}t"].include?(node.name) && node.node_type == opener
|
124
135
|
unless cell.nil?
|
125
136
|
node.read
|
126
137
|
cells[cell] = convert(node.value, cell_type, cell_style_idx)
|
@@ -177,7 +188,7 @@ module Creek
|
|
177
188
|
parse_xml(sheet_rels_filepath).css("Relationship[@Id='#{drawing_rid}']").first.attributes['Target'].value
|
178
189
|
end
|
179
190
|
|
180
|
-
def cell_id(column, use_simple_rows_format, row_number
|
191
|
+
def cell_id(column, use_simple_rows_format, row_number)
|
181
192
|
return "#{column}#{row_number}" unless use_simple_rows_format
|
182
193
|
|
183
194
|
with_headers && headers ? headers[column] : column
|
data/lib/creek/version.rb
CHANGED
data/spec/drawing_spec.rb
CHANGED
@@ -3,9 +3,11 @@ require './spec/spec_helper'
|
|
3
3
|
describe 'drawing' do
|
4
4
|
let(:book) { Creek::Book.new('spec/fixtures/sample-with-images.xlsx') }
|
5
5
|
let(:book_no_images) { Creek::Book.new('spec/fixtures/sample.xlsx') }
|
6
|
+
let(:book_with_one_cell_anchored_images) { Creek::Book.new('spec/fixtures/sample-with-one-cell-anchored-images.xlsx') }
|
6
7
|
let(:drawingfile) { 'xl/drawings/drawing1.xml' }
|
7
8
|
let(:drawing) { Creek::Drawing.new(book, drawingfile) }
|
8
9
|
let(:drawing_without_images) { Creek::Drawing.new(book_no_images, drawingfile) }
|
10
|
+
let(:drawing_with_one_cell_anchored_images) { Creek::Drawing.new(book_with_one_cell_anchored_images, drawingfile) }
|
9
11
|
|
10
12
|
describe '#has_images?' do
|
11
13
|
it 'has' do
|
@@ -48,5 +50,21 @@ describe 'drawing' do
|
|
48
50
|
expect(image1).to eq(image2)
|
49
51
|
end
|
50
52
|
end
|
53
|
+
|
54
|
+
context 'when one cell anchored images in cell' do
|
55
|
+
it 'returns image for anchored cell' do
|
56
|
+
image = drawing_with_one_cell_anchored_images.images_at('A2')[0]
|
57
|
+
expect(image.class).to eq(Pathname)
|
58
|
+
expect(image.exist?).to eq(true)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'returns nil for non-anchored cell' do
|
62
|
+
image = drawing_with_one_cell_anchored_images.images_at('A3')[0]
|
63
|
+
# Image can be seen present on cell A4 in `sample-with-one-cell-anchored-images.xlsx`
|
64
|
+
image_at_non_anchored_cell = drawing_with_one_cell_anchored_images.images_at('A4')
|
65
|
+
expect(image.class).to eq(Pathname)
|
66
|
+
expect(image_at_non_anchored_cell).to eq(nil)
|
67
|
+
end
|
68
|
+
end
|
51
69
|
end
|
52
70
|
end
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<sst xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="6" uniqueCount="5">
|
3
|
+
<x:si>
|
4
|
+
<x:t>Cell A1</x:t>
|
5
|
+
</x:si>
|
6
|
+
<x:si>
|
7
|
+
<x:t>Cell B1</x:t>
|
8
|
+
</x:si>
|
9
|
+
<x:si>
|
10
|
+
<x:t>My Cell</x:t>
|
11
|
+
</x:si>
|
12
|
+
<x:si>
|
13
|
+
<x:r>
|
14
|
+
<x:rPr>
|
15
|
+
<x:sz val="11"/>
|
16
|
+
<x:color rgb="FFFF0000"/>
|
17
|
+
<x:rFont val="Calibri"/>
|
18
|
+
<x:family val="2"/>
|
19
|
+
<x:scheme val="minor"/>
|
20
|
+
</x:rPr>
|
21
|
+
<x:t>Cell</x:t>
|
22
|
+
</x:r>
|
23
|
+
<x:r>
|
24
|
+
<x:rPr>
|
25
|
+
<x:sz val="11"/>
|
26
|
+
<x:color theme="1"/>
|
27
|
+
<x:rFont val="Calibri"/>
|
28
|
+
<x:family val="2"/>
|
29
|
+
<x:scheme val="minor"/>
|
30
|
+
</x:rPr>
|
31
|
+
<x:t xml:space="preserve"> </x:t>
|
32
|
+
</x:r>
|
33
|
+
<x:r>
|
34
|
+
<x:rPr>
|
35
|
+
<x:b/>
|
36
|
+
<x:sz val="11"/>
|
37
|
+
<x:color theme="1"/>
|
38
|
+
<x:rFont val="Calibri"/>
|
39
|
+
<x:family val="2"/>
|
40
|
+
<x:scheme val="minor"/>
|
41
|
+
</x:rPr>
|
42
|
+
<x:t>A2</x:t>
|
43
|
+
</x:r>
|
44
|
+
</x:si>
|
45
|
+
<x:si>
|
46
|
+
<x:r>
|
47
|
+
<x:rPr>
|
48
|
+
<x:sz val="11"/>
|
49
|
+
<x:color rgb="FF00B0F0"/>
|
50
|
+
<x:rFont val="Calibri"/>
|
51
|
+
<x:family val="2"/>
|
52
|
+
<x:scheme val="minor"/>
|
53
|
+
</x:rPr>
|
54
|
+
<x:t>Cell</x:t>
|
55
|
+
</x:r>
|
56
|
+
<x:r>
|
57
|
+
<x:rPr>
|
58
|
+
<x:sz val="11"/>
|
59
|
+
<x:color theme="1"/>
|
60
|
+
<x:rFont val="Calibri"/>
|
61
|
+
<x:family val="2"/>
|
62
|
+
<x:scheme val="minor"/>
|
63
|
+
</x:rPr>
|
64
|
+
<x:t xml:space="preserve"> </x:t>
|
65
|
+
</x:r>
|
66
|
+
<x:r>
|
67
|
+
<x:rPr>
|
68
|
+
<x:i/>
|
69
|
+
<x:sz val="11"/>
|
70
|
+
<x:color theme="1"/>
|
71
|
+
<x:rFont val="Calibri"/>
|
72
|
+
<x:family val="2"/>
|
73
|
+
<x:scheme val="minor"/>
|
74
|
+
</x:rPr>
|
75
|
+
<x:t>B2</x:t>
|
76
|
+
</x:r>
|
77
|
+
</x:si>
|
78
|
+
<x:si>
|
79
|
+
<x:t>Cell with_x000D_escaped_x000D_characters</x:t>
|
80
|
+
</x:si>
|
81
|
+
<x:si>
|
82
|
+
<x:t>吉田兼好</x:t>
|
83
|
+
<x:rPh sb="0" eb="2">
|
84
|
+
<x:t xml:space="preserve">ヨシダ </x:t>
|
85
|
+
</x:rPh>
|
86
|
+
<x:rPh sb="2" eb="4">
|
87
|
+
<x:t xml:space="preserve">ケンコウ </x:t>
|
88
|
+
</x:rPh>
|
89
|
+
<x:phoneticPr fontId="1"/>
|
90
|
+
</x:si>
|
91
|
+
</x:sst>
|
data/spec/shared_string_spec.rb
CHANGED
@@ -17,4 +17,21 @@ describe 'shared strings' do
|
|
17
17
|
expect(dictionary[6]).to eq('吉田兼好')
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
context 'when the nodes are namespaced' do
|
21
|
+
it 'parses the dictionary correctly' do
|
22
|
+
shared_strings_xml_file = File.open('spec/fixtures/sst_namespaced.xml')
|
23
|
+
doc = Nokogiri::XML(shared_strings_xml_file)
|
24
|
+
dictionary = Creek::SharedStrings.parse_shared_string_from_document(doc)
|
25
|
+
|
26
|
+
expect(dictionary.keys.size).to eq(7)
|
27
|
+
expect(dictionary[0]).to eq('Cell A1')
|
28
|
+
expect(dictionary[1]).to eq('Cell B1')
|
29
|
+
expect(dictionary[2]).to eq('My Cell')
|
30
|
+
expect(dictionary[3]).to eq('Cell A2')
|
31
|
+
expect(dictionary[4]).to eq('Cell B2')
|
32
|
+
expect(dictionary[5]).to eq("Cell with\rescaped\rcharacters")
|
33
|
+
expect(dictionary[6]).to eq('吉田兼好')
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/spec/sheet_spec.rb
CHANGED
@@ -65,6 +65,20 @@ describe 'sheet' do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
context 'when one cell anchored images in cell' do
|
69
|
+
let(:book_with_one_cell_anchored_images) { Creek::Book.new('spec/fixtures/sample-with-one-cell-anchored-images.xlsx') }
|
70
|
+
let(:sheet_with_one_cell_anchored_images) { Creek::Sheet.new(book_with_one_cell_anchored_images, 'Sheet 1', 1, '', '', '1', sheetfile) }
|
71
|
+
let(:rows) { sheet_with_one_cell_anchored_images.with_images.rows.map { |r| r } }
|
72
|
+
|
73
|
+
it 'returns image for anchored cell' do
|
74
|
+
expect(load_cell(rows, 'A2').size).to eq(1)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'returns nil for non-anchored cell' do
|
78
|
+
expect(load_cell(rows, 'A4')).to eq(nil)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
68
82
|
context 'with excel without images' do
|
69
83
|
let(:book_no_images) { Creek::Book.new('spec/fixtures/sample.xlsx') }
|
70
84
|
let(:sheet_no_images) { Creek::Sheet.new(book_no_images, 'Sheet 1', 1, '', '', '1', sheetfile) }
|
@@ -74,6 +88,16 @@ describe 'sheet' do
|
|
74
88
|
expect(load_cell(rows, 'A10')).to eq(0.15)
|
75
89
|
end
|
76
90
|
end
|
91
|
+
|
92
|
+
context 'when nodes are namespaced' do
|
93
|
+
let(:namespaced_book) { Creek::Book.new('spec/fixtures/sample_namespaced.xlsx') }
|
94
|
+
let(:namespaced_sheet) { Creek::Sheet.new(namespaced_book, 'Sheet 1', 1, '', '', '1', sheetfile) }
|
95
|
+
|
96
|
+
it 'parses rows correctly' do
|
97
|
+
rows = namespaced_sheet.rows.map { |r| r }
|
98
|
+
expect(load_cell(rows, 'A10')).to eq(0.15)
|
99
|
+
end
|
100
|
+
end
|
77
101
|
end
|
78
102
|
|
79
103
|
describe '#images_at' do
|
@@ -112,13 +136,55 @@ describe 'sheet' do
|
|
112
136
|
context 'when enable with_headers property' do
|
113
137
|
before { sheet.with_headers = true }
|
114
138
|
|
115
|
-
subject { sheet.simple_rows.to_a[1] }
|
116
|
-
|
117
139
|
it 'returns values by headers name' do
|
118
140
|
expect(subject['HeaderA']).to eq 'value1'
|
119
141
|
expect(subject['HeaderB']).to eq 'value2'
|
120
142
|
expect(subject['HeaderC']).to eq 'value3'
|
121
143
|
end
|
144
|
+
|
145
|
+
it 'returns headers correctly when called multiple times' do
|
146
|
+
row = sheet.simple_rows.to_a[1]
|
147
|
+
expect(row['HeaderA']).to eq 'value1'
|
148
|
+
expect(row['HeaderB']).to eq 'value2'
|
149
|
+
expect(row['HeaderC']).to eq 'value3'
|
150
|
+
|
151
|
+
row = sheet.simple_rows.to_a[1]
|
152
|
+
expect(row['HeaderA']).to eq 'value1'
|
153
|
+
expect(row['HeaderB']).to eq 'value2'
|
154
|
+
expect(row['HeaderC']).to eq 'value3'
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
context 'when nodes are namespaced' do
|
159
|
+
let(:namespaced_book) { Creek::Book.new('spec/fixtures/sample-with-headers_namespaced.xlsx') }
|
160
|
+
let(:sheet) { Creek::Sheet.new(namespaced_book, 'Sheet 1', 1, '', '', '1', sheetfile) }
|
161
|
+
|
162
|
+
it 'returns values by letters' do
|
163
|
+
expect(subject['A']).to eq 'value1'
|
164
|
+
expect(subject['B']).to eq 'value2'
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'when enable with_headers property' do
|
168
|
+
before { sheet.with_headers = true }
|
169
|
+
|
170
|
+
it 'returns values by headers name' do
|
171
|
+
expect(subject['HeaderA']).to eq 'value1'
|
172
|
+
expect(subject['HeaderB']).to eq 'value2'
|
173
|
+
expect(subject['HeaderC']).to eq 'value3'
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'returns headers correctly when called multiple times' do
|
177
|
+
row = sheet.simple_rows.to_a[1]
|
178
|
+
expect(row['HeaderA']).to eq 'value1'
|
179
|
+
expect(row['HeaderB']).to eq 'value2'
|
180
|
+
expect(row['HeaderC']).to eq 'value3'
|
181
|
+
|
182
|
+
row = sheet.simple_rows.to_a[1]
|
183
|
+
expect(row['HeaderA']).to eq 'value1'
|
184
|
+
expect(row['HeaderB']).to eq 'value2'
|
185
|
+
expect(row['HeaderC']).to eq 'value3'
|
186
|
+
end
|
187
|
+
end
|
122
188
|
end
|
123
189
|
end
|
124
190
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: creek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pythonicrubyist
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,6 +103,7 @@ extensions: []
|
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
105
|
- ".DS_Store"
|
106
|
+
- ".github/workflows/test.yml"
|
106
107
|
- ".gitignore"
|
107
108
|
- Gemfile
|
108
109
|
- LICENSE.txt
|
@@ -128,13 +129,17 @@ files:
|
|
128
129
|
- spec/fixtures/large_numbers.xlsx
|
129
130
|
- spec/fixtures/sample-as-zip.zip
|
130
131
|
- spec/fixtures/sample-with-headers.xlsx
|
132
|
+
- spec/fixtures/sample-with-headers_namespaced.xlsx
|
131
133
|
- spec/fixtures/sample-with-images.xlsx
|
134
|
+
- spec/fixtures/sample-with-one-cell-anchored-images.xlsx
|
132
135
|
- spec/fixtures/sample.xlsx
|
133
136
|
- spec/fixtures/sample_dates.xlsx
|
137
|
+
- spec/fixtures/sample_namespaced.xlsx
|
134
138
|
- spec/fixtures/sheets/sample_dates.xlsx
|
135
139
|
- spec/fixtures/sheets/sheet1.xml
|
136
140
|
- spec/fixtures/sheets/single_data_programme.xlsx
|
137
141
|
- spec/fixtures/sst.xml
|
142
|
+
- spec/fixtures/sst_namespaced.xml
|
138
143
|
- spec/fixtures/styles/first.xml
|
139
144
|
- spec/fixtures/temp_string_io_file_path_with_no_extension
|
140
145
|
- spec/shared_string_spec.rb
|
@@ -162,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
167
|
- !ruby/object:Gem::Version
|
163
168
|
version: '0'
|
164
169
|
requirements: []
|
165
|
-
rubygems_version: 3.0.
|
170
|
+
rubygems_version: 3.0.3.1
|
166
171
|
signing_key:
|
167
172
|
specification_version: 4
|
168
173
|
summary: A Ruby gem for parsing large Excel(xlsx and xlsm) files.
|
@@ -175,13 +180,17 @@ test_files:
|
|
175
180
|
- spec/fixtures/large_numbers.xlsx
|
176
181
|
- spec/fixtures/sample-as-zip.zip
|
177
182
|
- spec/fixtures/sample-with-headers.xlsx
|
183
|
+
- spec/fixtures/sample-with-headers_namespaced.xlsx
|
178
184
|
- spec/fixtures/sample-with-images.xlsx
|
185
|
+
- spec/fixtures/sample-with-one-cell-anchored-images.xlsx
|
179
186
|
- spec/fixtures/sample.xlsx
|
180
187
|
- spec/fixtures/sample_dates.xlsx
|
188
|
+
- spec/fixtures/sample_namespaced.xlsx
|
181
189
|
- spec/fixtures/sheets/sample_dates.xlsx
|
182
190
|
- spec/fixtures/sheets/sheet1.xml
|
183
191
|
- spec/fixtures/sheets/single_data_programme.xlsx
|
184
192
|
- spec/fixtures/sst.xml
|
193
|
+
- spec/fixtures/sst_namespaced.xml
|
185
194
|
- spec/fixtures/styles/first.xml
|
186
195
|
- spec/fixtures/temp_string_io_file_path_with_no_extension
|
187
196
|
- spec/shared_string_spec.rb
|