readymade 0.4.2 → 0.4.3

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: b9a882e1827fc02ccf9591bd9b553a3125400b613896043759e8d6b67583f1a6
4
- data.tar.gz: 6cd288e19b31eaf1584da299a72b8ba80dd9bf5eb89f8f8adeac0b161d68ff7b
3
+ metadata.gz: 76b10ba5747f0f419f053e590e091190bac60bbf3abf7b56b6281d39a65206c5
4
+ data.tar.gz: eb540a076609b60cff82538e0cb99273bdde57919efd4d29f9f1f681b39b15e6
5
5
  SHA512:
6
- metadata.gz: 18db5112a9b9d07f7a344fa9213cac219ffc99c82d6c74fa645839c9c3e25f1402c29d4d05aacf8baaafd2d67cde6d6e748708f73a486625b375ab32bad25db7
7
- data.tar.gz: bca496b18a8a38f5d1298aa379f11a6ff713fcb59d44ad34a31a753b518569186734c08032f94be8c407dd75dfd4e9c3709cc7b73d82fb969912515cfc4813d5
6
+ metadata.gz: 2eda9e59123b8730797c9fcefaa093bc9b1bcac092a5299acd7d40022c95567fd52df3981ed1e07615647f97513a56f36fd6ebfb7ab5c5dbb3b5e1ff42ddf5d8
7
+ data.tar.gz: d32d324a671e0104e91edd6e5a6e06147fe47fe34c6a5e2beb6b9f698ff5713be6775196e27e7c275f2f1be7e470c09b2d3b0852252ac56522037b1cb43b6881
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- readymade (0.4.2)
4
+ readymade (0.4.3)
5
5
  activejob
6
6
  activemodel
7
7
 
@@ -26,9 +26,9 @@ GEM
26
26
  securerandom (>= 0.3)
27
27
  tzinfo (~> 2.0, >= 2.0.5)
28
28
  uri (>= 0.13.1)
29
- base64 (0.2.0)
30
- benchmark (0.4.0)
31
- bigdecimal (3.1.9)
29
+ base64 (0.3.0)
30
+ benchmark (0.4.1)
31
+ bigdecimal (3.2.2)
32
32
  byebug (11.1.3)
33
33
  concurrent-ruby (1.3.5)
34
34
  connection_pool (2.5.3)
@@ -4,8 +4,12 @@ require 'active_job' unless defined?(::ActiveJob)
4
4
 
5
5
  module Readymade
6
6
  class BackgroundBangJob < ::Readymade::BackgroundJob
7
- def perform(**args)
8
- args.delete(:class_name).to_s.constantize.send(:call!, **args)
7
+ queue_as { self.arguments[0].dig(:queue_as) || self.arguments[0].dig(:job_options, :queue_as) || :default }
8
+
9
+ private
10
+
11
+ def callable_method
12
+ :call!
9
13
  end
10
14
  end
11
- end
15
+ end
@@ -4,39 +4,16 @@ require 'active_job' unless defined?(::ActiveJob)
4
4
 
5
5
  module Readymade
6
6
  class BackgroundJob < ::ActiveJob::Base
7
- queue_as do
8
- if (q = self.arguments[0][:queue_as]).present?
9
- logger.warn "DEPRECATED: `queue_as` is deprecated. Use `job_options.queue_as` instead."
10
- end
11
-
12
- self.arguments[0].dig(:job_options, :queue_as).presence || q || 'default'
13
- end
14
- rescue_from StandardError, with: :handle_rescue_from
7
+ queue_as { self.arguments[0].dig(:queue_as) || self.arguments[0].dig(:job_options, :queue_as) || :default }
15
8
 
16
9
  def perform(**args)
17
- args.delete(:class_name).to_s.constantize.send(:call, **args)
18
- end
19
-
20
- private
21
-
22
- def handle_rescue_from(exception)
23
- raise exception if job_options.blank? || job_options['discard_on'].blank?
24
-
25
- discard_on = job_options['discard_on'].map { |d| d['value'] }
26
-
27
- if discard_on.include?(exception.class.name)
28
- logger.warn "Discarding job due to deserialization error: #{exception.message}"
29
- # Discard the job without raising an error
30
- else
31
- logger.error "Job failed with deserialization error: #{exception.message}"
32
- raise exception
33
- end
10
+ args.delete(:class_name).to_s.constantize.send(callable_method, **args)
34
11
  end
35
12
 
36
13
  private
37
14
 
38
- def job_options
39
- @job_options ||= self.instance_variable_get('@serialized_arguments')[0]['job_options'] || {}
15
+ def callable_method
16
+ :call
40
17
  end
41
18
  end
42
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Readymade
4
- VERSION = '0.4.2'
4
+ VERSION = '0.4.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readymade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OrestF
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-26 00:00:00.000000000 Z
11
+ date: 2025-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -99,7 +99,6 @@ files:
99
99
  - Rakefile
100
100
  - bin/console
101
101
  - bin/setup
102
- - lib/.DS_Store
103
102
  - lib/readymade.rb
104
103
  - lib/readymade/action.rb
105
104
  - lib/readymade/background_bang_job.rb
data/lib/.DS_Store DELETED
Binary file