parceira 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,20 +53,26 @@ module Parceira
53
53
  header_data = input_file.readline.to_s.chomp(options[:row_sep]) if options[:headers_included] # Remove header row
54
54
  header_keys = \
55
55
  if options[:headers] == true
56
- data = CSV.parse(header_data, self.csv_options)
57
- self.parse_header( data )
56
+ begin
57
+ data = CSV.parse(header_data, self.csv_options)
58
+ self.parse_header( data )
59
+ rescue CSV::MalformedCSVError
60
+ end
58
61
  elsif options[:headers].is_a?(Array)
59
62
  options[:headers]
60
63
  end
61
64
 
62
65
  # now on to processing all the rest of the lines in the CSV file:
63
66
  while !input_file.eof? # we can't use f.readlines() here, because this would read the whole file into memory at once, and eof => true
64
- values = parse_values( CSV.parse(input_file.readline.chomp, csv_options) )
67
+ values = begin
68
+ parse_values( CSV.parse(input_file.readline.chomp, csv_options) )
69
+ rescue CSV::MalformedCSVError
70
+ end
65
71
  if header_keys
66
72
  output << convert_to_hash(header_keys, values)
67
73
  else
68
74
  output << values
69
- end
75
+ end if values
70
76
  end
71
77
  ensure
72
78
  $/ = $/
@@ -1,4 +1,4 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Parceira
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parceira
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: