Module: QueueProcessor::DependentCalculation::Config::Config

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

Instance Method Summary collapse

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



14
15
16
# File 'lib/queue-processor/dependent_calculation/config.rb', line 14

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

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

The name of the belongs_to that is our parent

  • Default: :dependent_calculation_group

  • Accepts: Symbol



22
23
24
# File 'lib/queue-processor/dependent_calculation/config.rb', line 22

def parent_calculation(value = nil)
  rw_config(:parent_calculation, value, :dependent_calculation_group)
end

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

Priority of the calculation

  • Default: A proc delegating priority to the parent

  • Accepts: Proc or Symbol



40
41
42
# File 'lib/queue-processor/dependent_calculation/config.rb', line 40

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

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

Which named queue should be used

  • Default: A proc delegating queue to the parent (if applicable) nil (any queu)

  • Accepts: Proc or Symbol



49
50
51
# File 'lib/queue-processor/dependent_calculation/config.rb', line 49

def queue(value = nil)
  rw_config(:queue, value, lambda { |object| object.parent_calculation&.queue })
end

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

When the calculation should run.

  • Default: A proc evaluating to nil (now in DJ terms)

  • Accepts: Proc or Symbol



31
32
33
# File 'lib/queue-processor/dependent_calculation/config.rb', line 31

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