batch_factory 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/batch_factory/parser.rb +12 -3
- data/lib/batch_factory/version.rb +1 -1
- metadata +2 -2
data/lib/batch_factory/parser.rb
CHANGED
@@ -39,12 +39,21 @@ module BatchFactory
|
|
39
39
|
|
40
40
|
for cell_index in @column_bounds[0]..@column_bounds[1]
|
41
41
|
if key = @heading_keys[cell_index] and
|
42
|
-
|
43
|
-
|
42
|
+
value = row[cell_index]
|
43
|
+
|
44
|
+
hash[key] = sanitize_value value if value.present?
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
47
|
-
@row_hashes << hash
|
48
|
+
@row_hashes << hash unless hash.empty?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def sanitize_value value
|
53
|
+
if value.is_a? Spreadsheet::Formula
|
54
|
+
value.value
|
55
|
+
else
|
56
|
+
value.to_s.strip
|
48
57
|
end
|
49
58
|
end
|
50
59
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: batch_factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spreadsheet
|