Module: ConsistentRandom::ActiveJob
- Defined in:
- lib/consistent_random/active_job.rb
Instance Attribute Summary collapse
-
#consistent_random_seed ⇒ String?
readonly
private
The seed deserialized from the job data.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#consistent_random_seed ⇒ String? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the seed deserialized from the job data.
7 8 9 |
# File 'lib/consistent_random/active_job.rb', line 7 def consistent_random_seed @consistent_random_seed end |
Class Method Details
.included(base) ⇒ Object
9 10 11 12 13 |
# File 'lib/consistent_random/active_job.rb', line 9 def self.included(base) base.around_perform :perform_with_consistent_random_scope base.class_attribute :inherit_consistent_random_scope, instance_writer: false end |
Instance Method Details
#deserialize(job_data) ⇒ Object
24 25 26 27 |
# File 'lib/consistent_random/active_job.rb', line 24 def deserialize(job_data) super @consistent_random_seed = job_data["consistent_random_seed"] end |
#serialize ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/consistent_random/active_job.rb', line 15 def serialize job_data = super if inherit_consistent_random_scope != false seed = ConsistentRandom.current_seed job_data["consistent_random_seed"] = seed unless seed.nil? end job_data end |