File tree Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -6,5 +6,6 @@ class Column
66
77 attribute :name , String
88 attribute :definition , ColumnDefinition
9+ attribute :rank , Integer , default : 0
910 end
1011end
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ def columns
1414
1515 Column . new (
1616 name : column_name ,
17- definition : find_column_definition ( column_name )
17+ definition : find_column_definition ( column_name ) ,
18+ rank : column_definitions . index { |definition | definition . match? ( column_name ) }
1819 )
1920 end
2021 end
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def csv_attributes
3333
3434 # Set attributes
3535 def set_attributes ( model )
36- header . columns . each do |column |
36+ header . columns . sort_by ( & :rank ) . each do |column |
3737 value = csv_attributes [ column . name ]
3838 begin
3939 value = value . dup if value
You can’t perform that action at this time.
0 commit comments