excel_utils 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +26 -0
- data/README.md +1 -1
- data/lib/excel_utils/version.rb +1 -1
- data/lib/excel_utils/writer.rb +5 -2
- data/spec/write_spec.rb +10 -1
- metadata +3 -3
- data/.travis.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0507cda2a3420f5c69d57f6ef3ba09410385a39444d1d8944532cd564db9bc8
|
4
|
+
data.tar.gz: 93f97d7e6e2577a7fb5d98b474c35b50d3914c503a2adde0f012c82f812cc349
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a335fa0c35aae34f171ea9fe533618e4145f3316883bb7bf27156a78456e342b0dfc99b8706d2dc8eca9de8c1d6707a9d1808ce3e9ad0788c8065bb60dd0b8d7
|
7
|
+
data.tar.gz: b698d64e528206b7e7319c343042f2b0dea677256412ae257f3d6e24c83032cf8dc0ce8128757e6ac96a57c305b0752a1cf53b7cceaf7468732128f57272ba1a
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ '**' ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ '**' ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
name: Tests
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', 'jruby-9.2.9.0']
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v3
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# ExcelUtils
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/excel_utils.svg)](https://rubygems.org/gems/excel_utils)
|
4
|
-
[![
|
4
|
+
[![CI](https://github.com/gabynaiman/excel_utils/actions/workflows/ci.yml/badge.svg)](https://github.com/gabynaiman/excel_utils/actions/workflows/ci.yml)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/github/gabynaiman/excel_utils/badge.svg?branch=master)](https://coveralls.io/github/gabynaiman/excel_utils?branch=master)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/gabynaiman/excel_utils.svg)](https://codeclimate.com/github/gabynaiman/excel_utils)
|
7
7
|
|
data/lib/excel_utils/version.rb
CHANGED
data/lib/excel_utils/writer.rb
CHANGED
@@ -44,10 +44,13 @@ module ExcelUtils
|
|
44
44
|
sheet_data.each_with_index do |row, r|
|
45
45
|
row_index = r + 1
|
46
46
|
header.each_with_index do |column, col_index|
|
47
|
-
|
47
|
+
unless row[column].nil?
|
48
48
|
if row[column].is_a?(String) || row[column].is_a?(Array)
|
49
49
|
sheet.write_string row_index, col_index, row[column]
|
50
50
|
|
51
|
+
elsif [true, false].include?(row[column])
|
52
|
+
sheet.write_string row_index, col_index, row[column].to_s
|
53
|
+
|
51
54
|
elsif row[column].respond_to? :to_time
|
52
55
|
time = row[column].to_time
|
53
56
|
type = date?(time) ? :date : :date_time
|
@@ -69,4 +72,4 @@ module ExcelUtils
|
|
69
72
|
end
|
70
73
|
|
71
74
|
end
|
72
|
-
end
|
75
|
+
end
|
data/spec/write_spec.rb
CHANGED
@@ -74,6 +74,15 @@ describe ExcelUtils do
|
|
74
74
|
assert_wrote rows, rows.map { |r| {'column_a' => r['column_a'].to_s} }
|
75
75
|
end
|
76
76
|
|
77
|
+
it 'Booleans' do
|
78
|
+
rows = [
|
79
|
+
{'column_a' => true, 'column_b' => 'text 1'},
|
80
|
+
{'column_a' => false, 'column_b' => 'text 2'}
|
81
|
+
]
|
82
|
+
|
83
|
+
assert_wrote rows, [{'column_a' => 'true', 'column_b' => 'text 1'}, {'column_a' => 'false', 'column_b' => 'text 2'}]
|
84
|
+
end
|
85
|
+
|
77
86
|
end
|
78
87
|
|
79
88
|
it 'Multiple sheets' do
|
@@ -93,4 +102,4 @@ describe ExcelUtils do
|
|
93
102
|
assert_wrote data
|
94
103
|
end
|
95
104
|
|
96
|
-
end
|
105
|
+
end
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inflecto
|
@@ -192,10 +192,10 @@ extensions: []
|
|
192
192
|
extra_rdoc_files: []
|
193
193
|
files:
|
194
194
|
- ".coveralls.yml"
|
195
|
+
- ".github/workflows/ci.yml"
|
195
196
|
- ".gitignore"
|
196
197
|
- ".ruby-gemset"
|
197
198
|
- ".ruby-version"
|
198
|
-
- ".travis.yml"
|
199
199
|
- Gemfile
|
200
200
|
- LICENSE.txt
|
201
201
|
- README.md
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- 2.0
|
5
|
-
- 2.1
|
6
|
-
- 2.2
|
7
|
-
- 2.3
|
8
|
-
- 2.4
|
9
|
-
- 2.5
|
10
|
-
- 2.6
|
11
|
-
- 2.7
|
12
|
-
- jruby-9.1.16.0
|
13
|
-
- jruby-9.2.9.0
|
14
|
-
- ruby-head
|
15
|
-
- jruby-head
|
16
|
-
|
17
|
-
matrix:
|
18
|
-
fast_finish: true
|
19
|
-
allow_failures:
|
20
|
-
- rvm: ruby-head
|
21
|
-
- rvm: jruby-head
|