From 5010b73afa984f2126f347411606961b709290fe Mon Sep 17 00:00:00 2001 From: Brian Shand Date: Thu, 6 Feb 2025 10:17:19 +0000 Subject: [PATCH 1/2] Fix concurrent-ruby version to 1.3.4 for older Rails versions --- gemfiles/Gemfile.rails61 | 3 +++ gemfiles/Gemfile.rails70 | 3 +++ 2 files changed, 6 insertions(+) diff --git a/gemfiles/Gemfile.rails61 b/gemfiles/Gemfile.rails61 index 2a1d471..9892137 100644 --- a/gemfiles/Gemfile.rails61 +++ b/gemfiles/Gemfile.rails61 @@ -3,3 +3,6 @@ source 'https://rubygems.org' gemspec path: '..' gem 'activesupport', '~> 6.1.0' + +# Latest concurrent-ruby breaks Rails < 7.1. See https://github.com/rails/rails/issues/54260 +gem 'concurrent-ruby', '1.3.4' diff --git a/gemfiles/Gemfile.rails70 b/gemfiles/Gemfile.rails70 index 759f44a..564657d 100644 --- a/gemfiles/Gemfile.rails70 +++ b/gemfiles/Gemfile.rails70 @@ -3,3 +3,6 @@ source 'https://rubygems.org' gemspec path: '..' gem 'activesupport', '~> 7.0.0' + +# Latest concurrent-ruby breaks Rails < 7.1. See https://github.com/rails/rails/issues/54260 +gem 'concurrent-ruby', '1.3.4' From 8603a1d9011ee3de2959c8d8dfab979e3f84cf33 Mon Sep 17 00:00:00 2001 From: Brian Shand Date: Thu, 6 Feb 2025 10:48:58 +0000 Subject: [PATCH 2/2] Fix CSV parsing bug --- CHANGELOG.md | 3 +++ lib/ndr_import/helpers/file/delimited.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcc5546..17aaa38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ ## [Unreleased] +### Fixed +* Fix CSV parsing bug + ### Added * Column zipping functionality * * Capturing Column name * diff --git a/lib/ndr_import/helpers/file/delimited.rb b/lib/ndr_import/helpers/file/delimited.rb index f119072..085422e 100644 --- a/lib/ndr_import/helpers/file/delimited.rb +++ b/lib/ndr_import/helpers/file/delimited.rb @@ -28,7 +28,7 @@ def delimited_tables(path, col_sep = nil, liberal = false) end # Iterate through the file line by line, yielding each one in turn. - def delimited_rows(path, col_sep = nil, liberal = false) + def delimited_rows(path, col_sep = nil, liberal = false) # rubocop:disable Style/OptionalBooleanParameter return enum_for(:delimited_rows, path, col_sep, liberal) unless block_given? safe_path = SafeFile.safepath_to_string(path) @@ -36,7 +36,7 @@ def delimited_rows(path, col_sep = nil, liberal = false) # By now, we know `options` should let us read the whole # file succesfully; if there are problems, we should crash. - CSV.foreach(safe_path, options.delete(:mode), **options) do |line| + CSV.foreach(safe_path, options[:mode], **options.except(:mode)) do |line| yield line.map(&:to_s) end end