acidic_job 1.0.0.pre12 → 1.0.0.pre13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1af7bca23aa5ead8fed158fb73565736555236bf4515ab73f631a3013e138f12
4
- data.tar.gz: cc1118240efe70d71dcd7c2eb07435f3e56934c2c3e8653848a9c3467dc60b83
3
+ metadata.gz: ff4783bfe9e3ff6a03683ed14a9f21a5227f6114bc5824cdee71a66f252d7fa1
4
+ data.tar.gz: d905d8ad1848d77ae9fade6b75527ae113675ba3c39b66149c750f9adb64d83b
5
5
  SHA512:
6
- metadata.gz: 90073b7d2964d65886ca2fd4320481455e04218db92ab3b2ccd65bdffc527b03f8c928c58590ed62cf7734c1702687978dd5f1406ea740f13f1fbccb7c27b48d
7
- data.tar.gz: 9f2910c1620f489a1bb5a310821ead5363671aa0ffc9a21f909894f43c2de52b056ee096f17455fb8b34bd55d8f521ca71760df3959b8b0c1f90562c50129ff4
6
+ metadata.gz: 1af39ccff6bb5d414ab32344887d60f4cf721d9272ec0c98c9686053d3426fd2da98d82b9fe35fd45ebc6b719b8e1df6ce922abbec86653a91bea736f9522696
7
+ data.tar.gz: f0f8db378646cd3e948a2406c2237b44c9e6a551dafcbe1a687cbfadc5a15713e3b6a177a18ccf81146b024cb64b44085a14c8250fd8b364f16c911d3a202f5b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acidic_job (1.0.0.pre12)
4
+ acidic_job (1.0.0.pre13)
5
5
  activerecord (>= 6.1.0)
6
6
  activesupport
7
7
 
@@ -4,46 +4,19 @@ module AcidicJob
4
4
  # NOTE: it is essential that this be a bare module and not an ActiveSupport::Concern
5
5
  module PerformWrapper
6
6
  def perform(*args, **kwargs)
7
- super_method = method(:perform).super_method
7
+ @__acidic_job_args = args
8
+ @__acidic_job_kwargs = kwargs
8
9
 
9
10
  # we don't want to run the `perform` callbacks twice, since ActiveJob already handles that for us
10
- if aj_job?
11
- __acidic_job_perform_for_aj(super_method, *args, **kwargs)
12
- elsif sk_job?
13
- __acidic_job_perform_for_sk(super_method, *args, **kwargs)
11
+ if defined?(ActiveJob) && self.class < ActiveJob::Base
12
+ super(*args, **kwargs)
13
+ elsif defined?(Sidekiq) && self.class.include?(Sidekiq::Worker)
14
+ run_callbacks :perform do
15
+ super(*args, **kwargs)
16
+ end
14
17
  else
15
18
  raise UnknownJobAdapter
16
19
  end
17
20
  end
18
-
19
- def sk_job?
20
- defined?(Sidekiq) && self.class.include?(Sidekiq::Worker)
21
- end
22
-
23
- def aj_job?
24
- defined?(ActiveJob) && self.class < ActiveJob::Base
25
- end
26
-
27
- private
28
-
29
- # don't run `perform` callbacks, as ActiveJob already does this
30
- def __acidic_job_perform_for_aj(super_method, *args, **kwargs)
31
- __acidic_job_perform_base(super_method, *args, **kwargs)
32
- end
33
-
34
- # ensure to run `perform` callbacks
35
- def __acidic_job_perform_for_sk(super_method, *args, **kwargs)
36
- run_callbacks :perform do
37
- __acidic_job_perform_base(super_method, *args, **kwargs)
38
- end
39
- end
40
-
41
- # capture arguments passed to `perform` to be used by AcidicJob later
42
- def __acidic_job_perform_base(super_method, *args, **kwargs)
43
- @__acidic_job_args = args
44
- @__acidic_job_kwargs = kwargs
45
-
46
- super_method.call(*args, **kwargs)
47
- end
48
21
  end
49
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AcidicJob
4
- VERSION = "1.0.0.pre12"
4
+ VERSION = "1.0.0.pre13"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acidic_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre12
4
+ version: 1.0.0.pre13
5
5
  platform: ruby
6
6
  authors:
7
7
  - fractaledmind
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-14 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord