Class: Shifty::Policy::Supply

Inherits:
Object
  • Object
show all
Defined in:
lib/shifty/policy.rb

Overview

Wraps a worker's supply so that values the task pulls directly (e.g. filter/batch/trailing workers calling supply.shift mid-task) cross the boundary under the same policy as the primary intake.

Instance Method Summary collapse

Constructor Details

#initialize(supply, worker) ⇒ Supply

Returns a new instance of Supply.



114
115
116
117
# File 'lib/shifty/policy.rb', line 114

def initialize(supply, worker)
  @supply = supply
  @worker = worker
end

Instance Method Details

#shiftObject



119
120
121
# File 'lib/shifty/policy.rb', line 119

def shift
  @worker.intake(@supply.shift)
end