mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Enable liberal_parsing
for ruby >=2.4
This commit is contained in:
parent
0f5edc9051
commit
d2d557dc7b
1 changed files with 10 additions and 1 deletions
|
@ -161,8 +161,17 @@ module Agents
|
|||
end
|
||||
end
|
||||
|
||||
def parse_csv_options(mo)
|
||||
options = {
|
||||
col_sep: separator(mo),
|
||||
headers: boolify(mo['with_header']),
|
||||
}
|
||||
options[:liberal_parsing] = true if CSV::DEFAULT_OPTIONS.key?(:liberal_parsing)
|
||||
options
|
||||
end
|
||||
|
||||
def parse_csv(io, mo, array = nil)
|
||||
CSV.new(io, col_sep: separator(mo), headers: boolify(mo['with_header'])).each do |row|
|
||||
CSV.new(io, **parse_csv_options(mo)).each do |row|
|
||||
if block_given?
|
||||
yield get_payload(row, mo)
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue