lib/rocket_job/lookup_collection.rb in rocketjob-6.0.0.rc1 vs lib/rocket_job/lookup_collection.rb in rocketjob-6.0.0.rc2

- old
+ new

@@ -20,12 +20,10 @@ # Returns [nil] if no record was found with the supplied id. def lookup(id) find(id: id).first end - private - # Internal class for uploading records in batches class BatchUploader attr_reader :record_count def self.upload(collection, **args) @@ -44,10 +42,13 @@ @collection = collection end def <<(record) raise(ArgumentError, "Record must be a Hash") unless record.is_a?(Hash) - raise(ArgumentError, "Record must include an :id key") unless record.key?(:id) || record.key?("id") || record.key?("_id") + + unless record.key?(:id) || record.key?("id") || record.key?("_id") + raise(ArgumentError, "Record must include an :id key") + end @documents << record @record_count += 1 @batch_count += 1 if @batch_count >= @batch_size