creek 2.4 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/lib/creek/styles/converter.rb +20 -2
- data/lib/creek/version.rb +1 -1
- data/spec/.DS_Store +0 -0
- data/spec/fixtures/large_numbers.xlsx +0 -0
- data/spec/test_spec.rb +21 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddab26a3269b8c9367e6e891bd9aff7e21c96310
|
4
|
+
data.tar.gz: 1959b38cd75e8836c39b2e2d0f8e332a8145f7bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35d72aab09ffc085e5869fe6a93d3249733820175e711749c7b13574f0545e9101cde0acb28dc800eb8be3900c46860095df32de728eda269724de3849a5a7d1
|
7
|
+
data.tar.gz: 88eb9a761857575f87dcf45d72362e7bc4000c410ce7ccc924a54383987cf2a64fa3693a8b19a38ed4fc3544e8c6fc63b0aef540332f140aa70a15ca949bdda5
|
data/.DS_Store
ADDED
Binary file
|
@@ -54,8 +54,10 @@ module Creek
|
|
54
54
|
# detected earlier and cast here by its standardized symbol
|
55
55
|
##
|
56
56
|
|
57
|
-
when :string
|
57
|
+
when :string
|
58
58
|
value
|
59
|
+
when :unsupported
|
60
|
+
convert_unknown(value)
|
59
61
|
when :fixnum
|
60
62
|
value.to_i
|
61
63
|
when :float, :percentage
|
@@ -69,7 +71,23 @@ module Creek
|
|
69
71
|
|
70
72
|
## Nothing matched
|
71
73
|
else
|
72
|
-
value
|
74
|
+
convert_unknown(value)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.convert_unknown(value)
|
79
|
+
begin
|
80
|
+
if value.nil? or value.empty?
|
81
|
+
return value
|
82
|
+
elsif value.to_i.to_s == value.to_s
|
83
|
+
return value.to_i
|
84
|
+
elsif value.to_f.to_s == value.to_s
|
85
|
+
return value.to_f
|
86
|
+
else
|
87
|
+
return value
|
88
|
+
end
|
89
|
+
rescue
|
90
|
+
return value
|
73
91
|
end
|
74
92
|
end
|
75
93
|
|
data/lib/creek/version.rb
CHANGED
data/spec/.DS_Store
ADDED
Binary file
|
Binary file
|
data/spec/test_spec.rb
CHANGED
@@ -54,6 +54,27 @@ describe 'Creek parsing dates on a sample XLSX file' do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
describe 'Creek parsing a file with large numbrts.' do
|
58
|
+
before(:all) do
|
59
|
+
@creek = Creek::Book.new 'spec/fixtures/large_numbers.xlsx'
|
60
|
+
@expected_simple_rows = [{"A"=>"7.83294732E8", "B"=>"783294732", "C"=>783294732.0}]
|
61
|
+
end
|
62
|
+
|
63
|
+
after(:all) do
|
64
|
+
@creek.close
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'Parse simple rows successfully.' do
|
68
|
+
rows = Array.new
|
69
|
+
row_count = 0
|
70
|
+
@creek.sheets[0].simple_rows.each do |row|
|
71
|
+
rows << row
|
72
|
+
row_count += 1
|
73
|
+
end
|
74
|
+
expect(rows[0]).to eq(@expected_simple_rows[0])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
57
78
|
describe 'Creek parsing a sample XLSX file' do
|
58
79
|
before(:all) do
|
59
80
|
@creek = Creek::Book.new 'spec/fixtures/sample.xlsx'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: creek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pythonicrubyist
|
@@ -116,6 +116,7 @@ executables: []
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
+
- ".DS_Store"
|
119
120
|
- ".gitignore"
|
120
121
|
- Gemfile
|
121
122
|
- LICENSE.txt
|
@@ -133,8 +134,10 @@ files:
|
|
133
134
|
- lib/creek/styles/style_types.rb
|
134
135
|
- lib/creek/utils.rb
|
135
136
|
- lib/creek/version.rb
|
137
|
+
- spec/.DS_Store
|
136
138
|
- spec/drawing_spec.rb
|
137
139
|
- spec/fixtures/invalid.xls
|
140
|
+
- spec/fixtures/large_numbers.xlsx
|
138
141
|
- spec/fixtures/sample-as-zip.zip
|
139
142
|
- spec/fixtures/sample-with-images.xlsx
|
140
143
|
- spec/fixtures/sample.xlsx
|
@@ -176,8 +179,10 @@ signing_key:
|
|
176
179
|
specification_version: 4
|
177
180
|
summary: A Ruby gem for parsing large Excel(xlsx and xlsm) files.
|
178
181
|
test_files:
|
182
|
+
- spec/.DS_Store
|
179
183
|
- spec/drawing_spec.rb
|
180
184
|
- spec/fixtures/invalid.xls
|
185
|
+
- spec/fixtures/large_numbers.xlsx
|
181
186
|
- spec/fixtures/sample-as-zip.zip
|
182
187
|
- spec/fixtures/sample-with-images.xlsx
|
183
188
|
- spec/fixtures/sample.xlsx
|