batch_factory 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- value = row[cell_index]
43
- hash[key] = value.to_s.strip if value.present?
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
 
@@ -1,3 +1,3 @@
1
1
  module BatchFactory
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
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.1
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-05-14 00:00:00.000000000 Z
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spreadsheet