Class: Yunhe::Consumer

Inherits:
Thread
  • Object
show all
Defined in:
lib/yunhe/consumer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue, block) ⇒ Consumer

Initialize a new consumer queue: the reference of the buffer queue block: the task to process the resource



10
11
12
13
14
# File 'lib/yunhe/consumer.rb', line 10

def initialize(queue, block)
  super &(method(:job).to_proc)
  @block = block
  self.queue = queue
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



4
5
6
# File 'lib/yunhe/consumer.rb', line 4

def block
  @block
end

#queueObject

Returns the value of attribute queue.



3
4
5
# File 'lib/yunhe/consumer.rb', line 3

def queue
  @queue
end