Class: Eventr::Publisher

Inherits:
SupervisedObject show all
Defined in:
lib/eventr/actors.rb

Instance Method Summary collapse

Methods inherited from SupervisedObject

#application, #on_exception, #on_exception=, #sleep_time_from_backoff, #start, #start_application_thread, #start_supervisor_thread, #stop, #supervisor, #threads

Constructor Details

#initialize(&block) ⇒ Publisher

Returns a new instance of Publisher.



116
117
118
119
# File 'lib/eventr/actors.rb', line 116

def initialize(&block)
  @block   = block
  @events  = Queue.new
end

Instance Method Details

#mainObject



126
127
128
# File 'lib/eventr/actors.rb', line 126

def main
  block.call(events)
end

#pop(non_block = false) ⇒ Object Also known as: shift



121
122
123
# File 'lib/eventr/actors.rb', line 121

def pop(non_block=false)
  events.pop(non_block)
end