Class: Celluloid::Actor::Sleeper

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

Instance Method Summary collapse

Constructor Details

#initialize(timers, interval) ⇒ Sleeper


258
259
260
261
# File 'lib/celluloid/actor.rb', line 258

def initialize(timers, interval)
  @timers = timers
  @interval = interval
end

Instance Method Details

#before_suspend(task) ⇒ Object


263
264
265
# File 'lib/celluloid/actor.rb', line 263

def before_suspend(task)
  @timers.after(@interval) { task.resume }
end

#waitObject


267
268
269
# File 'lib/celluloid/actor.rb', line 267

def wait
  Kernel.sleep(@interval)
end