Skip to content

Commit c58f11d

Browse files
committed
Rubocop changes
* Spacing, double quotes * Support Ruby < 3.2 by removing the implicit key/variable syntax
1 parent 67f28bd commit c58f11d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

app/models/solid_queue/job_batch.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def enqueue(attributes = {})
3535
def dispatch_finished_batches
3636
incomplete.order(:id).pluck(:id).each do |id|
3737
transaction do
38-
where(id:).non_blocking_lock.each(&:finish)
38+
where(id: id).non_blocking_lock.each(&:finish)
3939
end
4040
end
4141
end
@@ -82,8 +82,8 @@ def finish
8282
if on_finish_active_job.present?
8383
active_job = ActiveJob::Base.deserialize(on_finish_active_job)
8484
active_job.send(:deserialize_arguments_if_needed)
85-
active_job.arguments = [self] + Array.wrap(active_job.arguments)
86-
ActiveJob.perform_all_later([active_job])
85+
active_job.arguments = [ self ] + Array.wrap(active_job.arguments)
86+
ActiveJob.perform_all_later([ active_job ])
8787
attrs[:job] = Job.find_by(active_job_id: active_job.job_id)
8888
end
8989

lib/active_job/job_batch_id.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ module JobBatchId
1111
end
1212

1313
def serialize
14-
super.merge('batch_id' => batch_id)
14+
super.merge("batch_id" => batch_id)
1515
end
1616

1717
def deserialize(job_data)
1818
super
19-
self.batch_id = job_data['batch_id']
19+
self.batch_id = job_data["batch_id"]
2020
end
2121

2222
def batch

test/models/solid_queue/job_batch_test.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def perform(arg)
2323
end
2424

2525
test "batch will be completed on success" do
26-
batch = SolidQueue::JobBatch.enqueue(on_finish: BatchCompletionJob) {}
26+
batch = SolidQueue::JobBatch.enqueue(on_finish: BatchCompletionJob) { }
2727
assert_not_nil batch.on_finish_active_job
2828
assert_equal BatchCompletionJob.name, batch.on_finish_active_job["job_class"]
2929
end
3030

3131
test "batch will be completed on finish" do
32-
batch = SolidQueue::JobBatch.enqueue(on_success: BatchCompletionJob) {}
32+
batch = SolidQueue::JobBatch.enqueue(on_success: BatchCompletionJob) { }
3333
assert_not_nil batch.on_success_active_job
3434
assert_equal BatchCompletionJob.name, batch.on_success_active_job["job_class"]
3535
end
@@ -41,7 +41,7 @@ def perform(arg)
4141
end
4242

4343
assert_equal 2, SolidQueue::Job.count
44-
assert_equal [batch.id] * 2, SolidQueue::Job.last(2).map(&:batch_id)
44+
assert_equal [ batch.id ] * 2, SolidQueue::Job.last(2).map(&:batch_id)
4545
end
4646

4747
test "batch id is present inside the block" do
@@ -60,7 +60,7 @@ def perform(arg)
6060
end
6161

6262
assert_not_nil SolidQueue::JobBatch.last.on_finish_active_job["arguments"]
63-
assert_equal SolidQueue::JobBatch.last.on_finish_active_job["arguments"], [1, 2]
63+
assert_equal SolidQueue::JobBatch.last.on_finish_active_job["arguments"], [ 1, 2 ]
6464
assert_equal SolidQueue::JobBatch.last.on_finish_active_job["queue_name"], "batch"
6565
end
6666
end

0 commit comments

Comments
 (0)