map_fields 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/map_fields.rb +18 -16
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
data/lib/map_fields.rb CHANGED
@@ -49,23 +49,25 @@ module MapFields
49
49
  end
50
50
  end
51
51
 
52
- @rows = []
53
- begin
54
- FasterCSV.foreach(session[:map_fields][:file]) do |row|
55
- @rows << row
56
- break if @rows.size == 10
52
+ unless @map_fields_error
53
+ @rows = []
54
+ begin
55
+ FasterCSV.foreach(session[:map_fields][:file]) do |row|
56
+ @rows << row
57
+ break if @rows.size == 10
58
+ end
59
+ rescue FasterCSV::MalformedCSVError => e
60
+ @map_fields_error = e
61
+ end
62
+ expected_fields = self.class.read_inheritable_attribute(:map_fields_fields)
63
+ if expected_fields.respond_to?(:call)
64
+ expected_fields = expected_fields.call(params)
65
+ end
66
+ @fields = ([nil] + expected_fields).inject([]){ |o, e| o << [e, o.size]}
67
+ @parameters = []
68
+ options[:params].each do |param|
69
+ @parameters += ParamsParser.parse(params, param)
57
70
  end
58
- rescue FasterCSV::MalformedCSVError => e
59
- @map_fields_error = e
60
- end
61
- expected_fields = self.class.read_inheritable_attribute(:map_fields_fields)
62
- if expected_fields.respond_to?(:call)
63
- expected_fields = expected_fields.call(params)
64
- end
65
- @fields = ([nil] + expected_fields).inject([]){ |o, e| o << [e, o.size]}
66
- @parameters = []
67
- options[:params].each do |param|
68
- @parameters += ParamsParser.parse(params, param)
69
71
  end
70
72
  end
71
73
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 2
9
- version: 1.0.2
8
+ - 3
9
+ version: 1.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrew Timberlake