excel_utils 1.0.0 → 1.1.0

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: 13a477a8679749794ff54f4bb0a76c653b354be459d50ed1d7c89a6de8a32509
4
- data.tar.gz: 920a86b0b1fb587105d7fc78609cf5bdd98a231aa6bee22726ebdfc090b3daca
3
+ metadata.gz: 6493c2a06cb2a07929144889ea06b679e97c68b740ef5b18714d702c0f83bc01
4
+ data.tar.gz: ff567b623fd4e93095288d9d8d74fc23bd0275944628a861837daca10fb06391
5
5
  SHA512:
6
- metadata.gz: cfb43adfda51aa543e1dd13e00f952b9eb0d2c9cec9dd7b41119eea1b2e0b2db433e47040c224dda7069f0ff0ec0b6d17f43f215f50e60a66db4545ecc740f5a
7
- data.tar.gz: c1f424a05025b504b92cd5bf5b67f53c60129ad1973045daf263acf837301e61cc2681a9ce87a3ad90ba20e82a8ac1ef51891e9b2f6d387f4c3756fa6145a74f
6
+ metadata.gz: b37f20e6f1addcc3ca8f7bacd02d2a64309b9f8399a36a6b6096d73acd111e9de8c601bec278a27bd24541aa899ebbd56d437b47ed88735aec51fd0fa808bfc5
7
+ data.tar.gz: cd7ea90eb909e3119d59eae7a1a6e4d9c32435906a40df39e8bff946b7f5835af19e51b45ae13efdf02ce8b9fe8072fe4fdd28245a9c671255eed717ae3cf59f
@@ -1,3 +1,3 @@
1
1
  module ExcelUtils
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -3,10 +3,10 @@ module ExcelUtils
3
3
 
4
4
  attr_reader :filename, :normalize_column_names
5
5
 
6
- def initialize(filename, normalize_column_names: false)
6
+ def initialize(filename, normalize_column_names: false, extension: nil)
7
7
  @filename = filename
8
8
  @normalize_column_names = normalize_column_names
9
- @spreadsheet = Roo::Spreadsheet.open filename
9
+ @spreadsheet = Roo::Spreadsheet.open filename, extension: extension
10
10
  end
11
11
 
12
12
  def sheets
data/spec/read_spec.rb CHANGED
@@ -102,4 +102,10 @@ describe ExcelUtils, 'Read' do
102
102
 
103
103
  end
104
104
 
105
+ it 'Force extension' do
106
+ filename = File.expand_path "../sample.tmp", __FILE__
107
+ workbook = ExcelUtils.read filename, extension: 'xlsx'
108
+ workbook.sheets.count.must_equal 3
109
+ end
110
+
105
111
  end
data/spec/sample.tmp ADDED
Binary file
data/spec/write_spec.rb CHANGED
@@ -12,13 +12,16 @@ describe ExcelUtils do
12
12
  end
13
13
 
14
14
  it 'Write' do
15
+ long_url = 'https://external.xx.fbcdn.net/safe_image.php?d=AQCY1f77h1RtuFfa&w=720&h=720&url=https%3A%2F%2Fwww.mercadolibre.com%2Fjms%2Fmla%2Flgz%2Fbackground%2Fsession%2Farmor.c27f26204365785956aaf9b30c289d0d4b0a201b4b01dfc3d83162b82608973be9a82ac85c2097c3f23b522681adca38b143f5e1a10fda251b430051a1592bf19caba204c07179120c48d47a1ceb5a45.774f4b8036d4b909101bab92870d262a%3Fbackground%3Darmor.c27f26204365785956aaf9b30c289d0d4b0a201b4b01dfc3d83162b82608973be9a82ac85c2097c3f23b522681adca38b143f5e1a10fda251b430051a1592bf19caba204c07179120c48d47a1ceb5a45.774f4b8036d4b909101bab92870d262a%26message%3DeyJqc190eXBlIjoianNfY29va2llIiwidmFsdWUiOiJ4In0&cfs=1&_nc_hash=AQB9Sf1HyWCwCVhF'
16
+ long_text = 'AQCY1f77h1RtuFfa&w=720&h=720&url=https%3A%2F%2Fwww.mercadolibre.com%2Fjms%2Fmla%2Flgz%2Fbackground%2Fsession%2Farmor.c27f26204365785956aaf9b30c289d0d4b0a201b4b01dfc3d83162b82608973be9a82ac85c2097c3f23b522681adca38b143f5e1a10fda251b430051a1592bf19caba204c07179120c48d47a1ceb5a45.774f4b8036d4b909101bab92870d262a%3Fbackground%3Darmor.c27f26204365785956aaf9b30c289d0d4b0a201b4b01dfc3d83162b82608973be9a82ac85c2097c3f23b522681adca38b143f5e1a10fda251b430051a1592bf19caba204c07179120c48d47a1ceb5a45.774f4b8036d4b909101bab92870d262a%26message%3DeyJqc190eXBlIjoianNfY29va2llIiwidmFsdWUiOiJ4In0&cfs=1&_nc_hash=AQB9Sf1HyWCwCVhF'
17
+
15
18
  data = {
16
19
  'Sheet 1' => [
17
20
  {'column_a' => 1.5, 'column_b' => 'text 1', 'column_c' => DateTime.parse('2019-05-25T16:30:00')},
18
21
  {'column_b' => 'text 2', 'column_c' => Date.parse('2019-07-09'), 'column_a' => 2},
19
22
  ],
20
23
  'Sheet 2' => [
21
- {'Column A' => 'Text A', 'Column B' => 'Text B'}
24
+ {'Column A' => long_url, 'Column B' => long_text}
22
25
  ],
23
26
  'Sheet 3' => []
24
27
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excel_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-03 00:00:00.000000000 Z
11
+ date: 2020-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inflecto
@@ -195,6 +195,7 @@ files:
195
195
  - spec/coverage_helper.rb
196
196
  - spec/minitest_helper.rb
197
197
  - spec/read_spec.rb
198
+ - spec/sample.tmp
198
199
  - spec/sample.xls
199
200
  - spec/sample.xlsx
200
201
  - spec/write_spec.rb
@@ -225,6 +226,7 @@ test_files:
225
226
  - spec/coverage_helper.rb
226
227
  - spec/minitest_helper.rb
227
228
  - spec/read_spec.rb
229
+ - spec/sample.tmp
228
230
  - spec/sample.xls
229
231
  - spec/sample.xlsx
230
232
  - spec/write_spec.rb