excel-esv 1.0.0 → 2.0.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
  SHA1:
3
- metadata.gz: 513b0fc3dda205b323aef553991c8e0e384761d0
4
- data.tar.gz: f3992d8c2ff27f11d9e2265a88bd8338536528f1
3
+ metadata.gz: 296eaa62bc218863be1ed8d947df92b64fa20e3a
4
+ data.tar.gz: df593163f0e19a30bc541185369099e53dca4a67
5
5
  SHA512:
6
- metadata.gz: cf49d8366dc60c717b3c69761eb08da8ff131e151b628fca3811c51c1fd0ba7b5524c4188145005a3ee2eabf40ae20729b339c3a986ab25f14fbd1a0bd2c1784
7
- data.tar.gz: 654d305bbb67f52c2e23f123e2fd048e7495d199a1aa6b5b7ea342f7e1340e853ee059fd56ce67619da2e6792a98a57596a1b8809dccfd124dd8c13d447d4aaf
6
+ metadata.gz: e041a707d2f2280ed5e9281fcaa23ed0b57480fa27b6de36d31a0325c75008833e5bcde9857e6ed94a2c766f7127e5bf26c1fb2a7c2a6271e3b8b8a7548df535
7
+ data.tar.gz: e22498268e8c84dc2cd459eac4d87fcf49fb20c00201726ca2f09b21c4da33ca10f6524d55891798257913b4fa901f2079f08a151a9640c6f37440f92d9ffb0a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 2.0.0
2
+
3
+ * `parse` now returns an actual nested `Array`, not array-like `Spreadsheet::Row` records.
4
+
1
5
  # 1.0.0
2
6
 
3
7
  * `send_excel` now supports a `filename:` argument, e.g. `send_excel(data, filename: "salaries.xls")`.
data/lib/esv.rb CHANGED
@@ -25,7 +25,7 @@ module ESV
25
25
  worksheet_count = book.worksheets.length
26
26
  raise "Expected 1 worksheet, found #{worksheet_count}." if worksheet_count > 1
27
27
 
28
- book.worksheet(0).to_a
28
+ book.worksheet(0).to_a.map(&:to_a)
29
29
  end
30
30
 
31
31
  def self.parse_file(path)
data/lib/esv/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ESV
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
data/spec/esv_spec.rb CHANGED
@@ -23,6 +23,15 @@ describe ESV, ".parse" do
23
23
  }.to raise_error(/Expected 1 worksheet, found 2/)
24
24
  end
25
25
 
26
+ it "ignores formatting" do
27
+ output = ESV.parse(excel_file_with_formatting([1, 2]))
28
+ expect(output).to eq [
29
+ [ 1, 2 ],
30
+ ]
31
+
32
+ expect(output[0].class).to eq Array
33
+ end
34
+
26
35
  private
27
36
 
28
37
  def excel_file_with_two_worksheets
@@ -35,6 +44,18 @@ describe ESV, ".parse" do
35
44
  book.write(fake_file)
36
45
  data
37
46
  end
47
+
48
+ def excel_file_with_formatting(data)
49
+ book = Spreadsheet::Workbook.new
50
+ sheet = book.create_worksheet
51
+ sheet.row(0).replace(data)
52
+ sheet.row(0).default_format = Spreadsheet::Format.new(color: :blue)
53
+
54
+ data = ""
55
+ fake_file = StringIO.new(data)
56
+ book.write(fake_file)
57
+ data
58
+ end
38
59
  end
39
60
 
40
61
  describe ESV, ".generate_file and .parse_file" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excel-esv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-08 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spreadsheet