Class: Poller

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

Instance Method Summary collapse

Constructor Details

#initialize(waiter, continuer, action) ⇒ Poller

Returns a new instance of Poller.



3
4
5
6
7
# File 'lib/poller.rb', line 3

def initialize(waiter, continuer, action)
  @waiter = waiter
  @continuer = continuer
  @action = action
end

Instance Method Details

#startObject



9
10
11
12
13
14
15
# File 'lib/poller.rb', line 9

def start
  ran = false
  while @continuer.continue?
    @waiter.wait unless ran
    ran = @action.run
  end
end