Module: Wurk::Job::Options::ClassMethods

Defined in:
lib/wurk/job/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#sidekiq_retries_exhausted_blockObject (readonly)

Returns the value of attribute sidekiq_retries_exhausted_block.



35
36
37
# File 'lib/wurk/job/options.rb', line 35

def sidekiq_retries_exhausted_block
  @sidekiq_retries_exhausted_block
end

#sidekiq_retry_in_blockObject (readonly)

Returns the value of attribute sidekiq_retry_in_block.



35
36
37
# File 'lib/wurk/job/options.rb', line 35

def sidekiq_retry_in_block
  @sidekiq_retry_in_block
end

Instance Method Details

#get_sidekiq_optionsObject

Sidekiq’s public API name — must stay ‘get_sidekiq_options`.



27
28
29
# File 'lib/wurk/job/options.rb', line 27

def get_sidekiq_options # rubocop:disable Naming/AccessorMethodName
  @sidekiq_options_hash ||= inherited_sidekiq_options # rubocop:disable Naming/MemoizedInstanceVariableName
end

#inherited(subclass) ⇒ Object



45
46
47
48
49
50
# File 'lib/wurk/job/options.rb', line 45

def inherited(subclass)
  super
  subclass.instance_variable_set(:@sidekiq_options_hash, get_sidekiq_options.dup)
  inherit_ivar(subclass, :@sidekiq_retry_in_block)
  inherit_ivar(subclass, :@sidekiq_retries_exhausted_block)
end

#sidekiq_options(opts = {}) ⇒ Object



21
22
23
24
# File 'lib/wurk/job/options.rb', line 21

def sidekiq_options(opts = {})
  merged = get_sidekiq_options.merge(opts.transform_keys(&:to_s))
  @sidekiq_options_hash = merged
end

#sidekiq_options_hashObject



31
32
33
# File 'lib/wurk/job/options.rb', line 31

def sidekiq_options_hash
  get_sidekiq_options
end

#sidekiq_retries_exhausted(&block) ⇒ Object



41
42
43
# File 'lib/wurk/job/options.rb', line 41

def sidekiq_retries_exhausted(&block)
  @sidekiq_retries_exhausted_block = block
end

#sidekiq_retry_in(&block) ⇒ Object



37
38
39
# File 'lib/wurk/job/options.rb', line 37

def sidekiq_retry_in(&block)
  @sidekiq_retry_in_block = block
end