Skip to content

Commit

Permalink
Refactor cast_rows csv row handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pezholio committed Oct 11, 2016
1 parent edc7c24 commit 3bdb635
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/jsontableschema/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ def cast_rows(rows, fail_fast = true, limit = nil)
rows.each_with_index do |r, i|
begin
break if limit && (limit <= i)
if r.class == CSV::Row
parsed_rows << cast_row(r.fields, fail_fast)
else
parsed_rows << cast_row(r, fail_fast)
end
r = r.fields if r.class == CSV::Row
parsed_rows << cast_row(r, fail_fast)
rescue MultipleInvalid, ConversionError => e
raise e if fail_fast == true
@errors << e if e.is_a?(ConversionError)
Expand Down

0 comments on commit 3bdb635

Please sign in to comment.