Module: Wurk::Job::Options::ClassMethods
- Defined in:
- lib/wurk/job/options.rb
Instance Attribute Summary collapse
-
#sidekiq_retries_exhausted_block ⇒ Object
readonly
Returns the value of attribute sidekiq_retries_exhausted_block.
-
#sidekiq_retry_in_block ⇒ Object
readonly
Returns the value of attribute sidekiq_retry_in_block.
Instance Method Summary collapse
-
#get_sidekiq_options ⇒ Object
Sidekiq's public API name — must stay
get_sidekiq_options. - #inherited(subclass) ⇒ Object
-
#sidekiq_options(opts = {}) ⇒ Object
Deliberately identical to Wurk::Worker::ClassMethods#sidekiq_options, validation included: an ActiveJob class configuring a Wurk option must be told about a bad value at the same place a plain worker is.
- #sidekiq_options_hash ⇒ Object
- #sidekiq_retries_exhausted(&block) ⇒ Object
- #sidekiq_retry_in(&block) ⇒ Object
Instance Attribute Details
#sidekiq_retries_exhausted_block ⇒ Object (readonly)
Returns the value of attribute sidekiq_retries_exhausted_block.
45 46 47 |
# File 'lib/wurk/job/options.rb', line 45 def sidekiq_retries_exhausted_block @sidekiq_retries_exhausted_block end |
#sidekiq_retry_in_block ⇒ Object (readonly)
Returns the value of attribute sidekiq_retry_in_block.
45 46 47 |
# File 'lib/wurk/job/options.rb', line 45 def sidekiq_retry_in_block @sidekiq_retry_in_block end |
Instance Method Details
#get_sidekiq_options ⇒ Object
Sidekiq's public API name — must stay get_sidekiq_options.
37 38 39 |
# File 'lib/wurk/job/options.rb', line 37 def # rubocop:disable Naming/AccessorMethodName @sidekiq_options_hash ||= # rubocop:disable Naming/MemoizedInstanceVariableName end |
#inherited(subclass) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/wurk/job/options.rb', line 55 def inherited(subclass) super subclass.instance_variable_set(:@sidekiq_options_hash, .dup) inherit_ivar(subclass, :@sidekiq_retry_in_block) inherit_ivar(subclass, :@sidekiq_retries_exhausted_block) end |
#sidekiq_options(opts = {}) ⇒ Object
Deliberately identical to Wurk::Worker::ClassMethods#sidekiq_options, validation included: an ActiveJob class configuring a Wurk option must be told about a bad value at the same place a plain worker is.
27 28 29 30 31 32 33 34 |
# File 'lib/wurk/job/options.rb', line 27 def (opts = {}) stringified = opts.transform_keys(&:to_s) Wurk::JobUtil.validate_track!(stringified['track'], stringified) if stringified.key?('track') Wurk::JobUtil.validate_bounds!(stringified) merged = .merge(stringified) Wurk::Collapse.policy_for(merged) @sidekiq_options_hash = merged end |
#sidekiq_options_hash ⇒ Object
41 42 43 |
# File 'lib/wurk/job/options.rb', line 41 def end |
#sidekiq_retries_exhausted(&block) ⇒ Object
51 52 53 |
# File 'lib/wurk/job/options.rb', line 51 def sidekiq_retries_exhausted(&block) @sidekiq_retries_exhausted_block = block end |
#sidekiq_retry_in(&block) ⇒ Object
47 48 49 |
# File 'lib/wurk/job/options.rb', line 47 def sidekiq_retry_in(&block) @sidekiq_retry_in_block = block end |