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

Returns a new instance of Sleeper.



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

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

Instance Method Details

#before_suspend(task) ⇒ Object



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

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

#waitObject



270
271
272
# File 'lib/celluloid/actor.rb', line 270

def wait
  Kernel.sleep(@interval)
end