creek 2.5.2 → 2.5.3

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
  SHA256:
3
- metadata.gz: 1b9680127cd771d8b0840567db333a2a32369952bbeb09eee7364a9dbcdd2284
4
- data.tar.gz: e39694d00b142e542457cc585d9b0e027386a8a3fcdb39b0cfe670f6e8d57b81
3
+ metadata.gz: 0d90975898b7d260d37f6543755f8c2f4d5931d6e387a56c343bce23eee7e3b1
4
+ data.tar.gz: 0c381e483070a0e883f128e1a03147a5acf60c4a1095b42ef0d3106af7889f8b
5
5
  SHA512:
6
- metadata.gz: ffa323e9d0f5a9c7976750d4c802a10ca39517b7f2ed388c801c5109aa331a109128dfdfcc5a039e919a2f3e28b9099b9839face7594b1667ccf76cb0bef1bca
7
- data.tar.gz: 6c5d6dc7b921d504490502b9e2c37def7112d23bb4a8f6d4a3a7e28d68bc6f297b0ff2864725c2186f302106c40543f4369a54c6884d3a3d908aaf0355539c6f
6
+ metadata.gz: 1f23c318b54b45c2d1732c874e3f6519e7d528175a395b888e3352f302fb1f0b8625cdde965f16540081163282751dd410a712281651b9b3d3b91c9e89bec800
7
+ data.tar.gz: e601060be6ba35b3bc3ded42865bce8b46fc3ca92feec1439dc2e719f132bb2359d06129f1110dc6676d07f7707364fead716f8f584a5851388a1d183c6e6825
data/lib/creek/sheet.rb CHANGED
@@ -92,6 +92,7 @@ module Creek
92
92
  opener = Nokogiri::XML::Reader::TYPE_ELEMENT
93
93
  closer = Nokogiri::XML::Reader::TYPE_END_ELEMENT
94
94
  Enumerator.new do |y|
95
+ @headers = nil
95
96
  row, cells, cell = nil, {}, nil
96
97
  cell_type = nil
97
98
  cell_style_idx = nil
@@ -104,7 +105,7 @@ module Creek
104
105
  y << (include_meta_data ? row : cells) if node.self_closing?
105
106
  elsif node.name == 'row' && node.node_type == closer
106
107
  processed_cells = fill_in_empty_cells(cells, row['r'], cell, use_simple_rows_format)
107
- @headers = processed_cells if row['r'] == HEADERS_ROW_NUMBER
108
+ @headers = processed_cells if with_headers && row['r'] == HEADERS_ROW_NUMBER
108
109
 
109
110
  if @images_present
110
111
  processed_cells.each do |cell_name, cell_value|
@@ -177,7 +178,7 @@ module Creek
177
178
  parse_xml(sheet_rels_filepath).css("Relationship[@Id='#{drawing_rid}']").first.attributes['Target'].value
178
179
  end
179
180
 
180
- def cell_id(column, use_simple_rows_format, row_number = '')
181
+ def cell_id(column, use_simple_rows_format, row_number)
181
182
  return "#{column}#{row_number}" unless use_simple_rows_format
182
183
 
183
184
  with_headers && headers ? headers[column] : column
@@ -110,7 +110,7 @@ module Creek
110
110
 
111
111
  def self.convert_bignum(value)
112
112
  if defined?(BigDecimal)
113
- BigDecimal.new(value)
113
+ BigDecimal(value)
114
114
  else
115
115
  value.to_f
116
116
  end
data/lib/creek/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Creek
2
- VERSION = "2.5.2"
2
+ VERSION = "2.5.3"
3
3
  end
data/spec/sheet_spec.rb CHANGED
@@ -112,13 +112,23 @@ describe 'sheet' do
112
112
  context 'when enable with_headers property' do
113
113
  before { sheet.with_headers = true }
114
114
 
115
- subject { sheet.simple_rows.to_a[1] }
116
-
117
115
  it 'returns values by headers name' do
118
116
  expect(subject['HeaderA']).to eq 'value1'
119
117
  expect(subject['HeaderB']).to eq 'value2'
120
118
  expect(subject['HeaderC']).to eq 'value3'
121
119
  end
120
+
121
+ it 'returns headers correctly when called multiple times' do
122
+ row = sheet.simple_rows.to_a[1]
123
+ expect(row['HeaderA']).to eq 'value1'
124
+ expect(row['HeaderB']).to eq 'value2'
125
+ expect(row['HeaderC']).to eq 'value3'
126
+
127
+ row = sheet.simple_rows.to_a[1]
128
+ expect(row['HeaderA']).to eq 'value1'
129
+ expect(row['HeaderB']).to eq 'value2'
130
+ expect(row['HeaderC']).to eq 'value3'
131
+ end
122
132
  end
123
133
  end
124
134
  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: 2.5.2
4
+ version: 2.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - pythonicrubyist
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-21 00:00:00.000000000 Z
11
+ date: 2021-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  requirements: []
165
- rubygems_version: 3.0.8
165
+ rubygems_version: 3.0.3
166
166
  signing_key:
167
167
  specification_version: 4
168
168
  summary: A Ruby gem for parsing large Excel(xlsx and xlsm) files.