active_importer 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/active_importer/base.rb
CHANGED
@@ -27,6 +27,7 @@ module ActiveImporter
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.column(title, field, &block)
|
30
|
+
title = title.strip
|
30
31
|
if columns[title]
|
31
32
|
raise "Duplicate importer column '#{title}'"
|
32
33
|
end
|
@@ -51,10 +52,10 @@ module ActiveImporter
|
|
51
52
|
@context = options.delete(:context)
|
52
53
|
|
53
54
|
@book = Roo::Spreadsheet.open(file, options)
|
54
|
-
@header = @book.row(1)
|
55
|
+
@header = @book.row(1).map(&:strip)
|
55
56
|
check_header
|
56
57
|
|
57
|
-
@data_row_indices = (2..@book.
|
58
|
+
@data_row_indices = (2..@book.last_row)
|
58
59
|
@row_count = @data_row_indices.count
|
59
60
|
rescue => e
|
60
61
|
@book = @header = nil
|
data/spec/stubs/employee.rb
CHANGED
@@ -14,7 +14,7 @@ class EmployeeImporter < ActiveImporter::Base
|
|
14
14
|
|
15
15
|
column 'Name', :name
|
16
16
|
column 'Birth Date', :birth_date
|
17
|
-
column 'Department', :department_id do |value|
|
17
|
+
column ' Department ', :department_id do |value|
|
18
18
|
value.length # Quick dummy way to get an integer out of a string
|
19
19
|
end
|
20
20
|
end
|
data/spec/stubs/spreadsheet.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_importer
|
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:
|
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
segments:
|
114
114
|
- 0
|
115
|
-
hash: -
|
115
|
+
hash: -3244463273596288739
|
116
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
segments:
|
123
123
|
- 0
|
124
|
-
hash: -
|
124
|
+
hash: -3244463273596288739
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
127
|
rubygems_version: 1.8.23
|