Module: QueueProcessor::RootCalculation::Config::Config

Defined in:
lib/queue-processor/root_calculation/config.rb

Instance Method Summary collapse

Instance Method Details

#dependent_calculation_group_association(value = nil) ⇒ Object Also known as: dependent_calculation_group_association=

The name of the has_many association are our dependent calculations

  • Default: :dependent_calculation_groups

  • Accepts: Symbol



26
27
28
# File 'lib/queue-processor/root_calculation/config.rb', line 26

def dependent_calculation_group_association(value = nil)
  rw_config(:dependent_calculation_group_association, value, :dependent_calculation_groups)
end

#priority(value = nil) ⇒ Object Also known as: priority=

Priority of the calculation

  • Default: A proc evaluating to 0 (highest priority in DJ terms)

  • Accepts: Proc or Symbol



44
45
46
# File 'lib/queue-processor/root_calculation/config.rb', line 44

def priority(value = nil)
  rw_config(:priority, value, lambda {|object| 0 })
end

#queue(value = nil) ⇒ Object Also known as: queue=

Which named queue should be used

  • Default: nil, any queue

  • Accepts: Proc or Symbol



63
64
65
# File 'lib/queue-processor/root_calculation/config.rb', line 63

def queue(value = nil)
  rw_config(:queue, value, nil)
end

#recover_after(value = nil) ⇒ Object Also known as: recover_after=

How long we’ll let a job set in the queue before process it anyway

  • Default: nil

  • Accepts: a time, for example: 10.minutes



53
54
55
# File 'lib/queue-processor/root_calculation/config.rb', line 53

def recover_after(value = nil)
  rw_config(:recover_after, value, nil )
end

#root_calculation_config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



18
19
20
# File 'lib/queue-processor/root_calculation/config.rb', line 18

def root_calculation_config(&block)
  yield self if block_given?
end

#run_at(value = nil) ⇒ Object Also known as: run_at=

When the calculation should run.

  • Default: A proc evaluating to 5 seconds in the future

  • Accepts: Proc or Symbol



35
36
37
# File 'lib/queue-processor/root_calculation/config.rb', line 35

def run_at(value = nil)
  rw_config(:run_at, value, lambda {|object| Time.now + 5.seconds })
end