Class: SuperPoller::Poller

Inherits:
Object
  • Object
show all
Defined in:
lib/super_poller/poller.rb

Direct Known Subclasses

NoneBlockingPoller

Instance Method Summary collapse

Constructor Details

#initialize(queue, message_handler) ⇒ Poller

Returns a new instance of Poller.



2
3
4
# File 'lib/super_poller/poller.rb', line 2

def initialize(queue, message_handler)
  @message_handler, @queue = message_handler, queue
end

Instance Method Details

#pollObject



6
7
8
# File 'lib/super_poller/poller.rb', line 6

def poll
  @message_handler.call(get_message)
end

#start!Object



10
11
12
# File 'lib/super_poller/poller.rb', line 10

def start!
  poll while true
end