Skip to content

Commit

Permalink
Check if CSV constant is loaded
Browse files Browse the repository at this point in the history
This moves any uninitialized constant error to the calling code,
which hopefully makes it clear to devs that they should
`require "csv"` before using the CsvEnumerator.
  • Loading branch information
fatkodima committed May 4, 2024
1 parent 2f37200 commit 3b3dcad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sidekiq_iteration/csv_enumerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CsvEnumerator
# SidekiqIteration::CsvEnumerator.new(csv).rows(cursor: cursor)
#
def initialize(csv)
unless csv.instance_of?(CSV)
unless defined?(CSV) && csv.instance_of?(CSV)
raise ArgumentError, "CsvEnumerator.new takes CSV object"
end

Expand Down

0 comments on commit 3b3dcad

Please sign in to comment.