marj 4.0.0 → 4.1.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -6
  3. data/lib/marj.rb +10 -2
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4eb6129fa4948ed6e108469f44f380cda908620c6d08392cfa1e8c3bc84a9875
4
- data.tar.gz: 28faed9a10fa3a8c885b521d6c3465196f814e97af07018d5eea88e580f322a9
3
+ metadata.gz: 8ea99cb466811e6f77fb6476e7e8ca02b7345c8d297ebdb1954b9109f772bfd9
4
+ data.tar.gz: 35a1ed99e2afe6934a5a7ea9b40375a93d5c79b9c46d304aac49457913794fba
5
5
  SHA512:
6
- metadata.gz: 5f984f366a9cefb3187cbac7129144c8241d46d00357d719ec442dfce62d5c833c95ec30363a5af867e111499cc91cd2c60768da55d04c9c7fc401cce8ac3f83
7
- data.tar.gz: e86029649f11ca05f96efcae59c1c60212b29335d9b154c3288a15aa81cd432b46f960166680b5bb0a534346852ccc73970cbaf8a298eb52893c37e260854f61
6
+ metadata.gz: 0a1568a19c7faeedc80d0a17cf71c536a5dcb9b497645c87772213b5a20ca22b8ae250099826a75654d36260b5d34d77c896b81b28cc87e3ec1e4e181b5440bb
7
+ data.tar.gz: 701727d777c8f9c990bdca6d66f9cf3d76d41eddddd77f1dbcbb1c75cff5b75b7acce065cb5c83b01c23dff3a6878218b4b6f3c4528d0e307ae8bc8e192d91e9
data/README.md CHANGED
@@ -108,7 +108,7 @@ ensure
108
108
  end
109
109
  ```
110
110
 
111
- # Jobs Interface
111
+ ## Jobs Interface
112
112
 
113
113
  The `Marj` module provides methods for interacting with enqueued jobs. These
114
114
  methods accept, return and yield +ActiveJob+ objects rather than +ActiveRecord+
@@ -135,7 +135,7 @@ Query methods can also be chained:
135
135
  Marj.due.where(job_class: SomeJob).next # Returns the next SomeJob that is due
136
136
  ```
137
137
 
138
- # Custom Jobs Interface
138
+ ## Custom Jobs Interface
139
139
 
140
140
  The `Marj::JobsInterface` can be added to any class or module. For example, to
141
141
  add it to all jobs classes:
@@ -158,11 +158,10 @@ ApplicationJob.due # Returns all jobs which are due to be executed.
158
158
  SomeJob.due # Returns SomeJobs which are due to be executed.
159
159
  ```
160
160
 
161
- ## Customization
161
+ ## Multiple Tables
162
162
 
163
- It is possible to create a custom record class and jobs interface. This enables,
164
- for instance, writing jobs to multiple databases/tables within a single
165
- application.
163
+ It is possible to create a custom record class in order to, for instance,
164
+ write jobs to multiple databases/tables within a single application.
166
165
 
167
166
  ```ruby
168
167
  class CreateMyJobs < ActiveRecord::Migration[7.1]
data/lib/marj.rb CHANGED
@@ -30,7 +30,7 @@ require_relative 'marj/relation'
30
30
  # See https://github.com/nicholasdower/marj
31
31
  module Marj
32
32
  # The Marj version.
33
- VERSION = '4.0.0'
33
+ VERSION = '4.1.0'
34
34
 
35
35
  Kernel.autoload(:Record, File.expand_path(File.join('marj', 'record.rb'), __dir__))
36
36
 
@@ -87,7 +87,15 @@ module Marj
87
87
  # ActiveJob::Base#deserialize expects dates to be strings rather than Time objects.
88
88
  job_data = job_data.to_h { |k, v| [k, %w[enqueued_at scheduled_at].include?(k) ? v&.iso8601 : v] }
89
89
 
90
- job.tap { job.deserialize(job_data) }
90
+ job.deserialize(job_data)
91
+
92
+ # ActiveJob deserializes arguments on demand when a job is performed. Until then they are empty. That's strange.
93
+ # Instead, deserialize them now. Also, clear `serialized_arguments` to prevent ActiveJob from overwriting changes
94
+ # to arguments when serializing later.
95
+ job.arguments = record.arguments
96
+ job.serialized_arguments = nil
97
+
98
+ job
91
99
  end
92
100
 
93
101
  # Registers callbacks for the given job which destroy the given database record when the job succeeds or is
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marj
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Dower
@@ -57,8 +57,8 @@ licenses:
57
57
  - MIT
58
58
  metadata:
59
59
  bug_tracker_uri: https://github.com/nicholasdower/marj/issues
60
- changelog_uri: https://github.com/nicholasdower/marj/releases/tag/v4.0.0
61
- documentation_uri: https://www.rubydoc.info/github/nicholasdower/marj/v4.0.0
60
+ changelog_uri: https://github.com/nicholasdower/marj/releases/tag/v4.1.0
61
+ documentation_uri: https://www.rubydoc.info/github/nicholasdower/marj/v4.1.0
62
62
  homepage_uri: https://github.com/nicholasdower/marj
63
63
  rubygems_mfa_required: 'true'
64
64
  source_code_uri: https://github.com/nicholasdower/marj