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.


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

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

Instance Method Details

#before_suspend(task) ⇒ Object


272
273
274
# File 'lib/celluloid/actor.rb', line 272

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

#waitObject


276
277
278
# File 'lib/celluloid/actor.rb', line 276

def wait
  Kernel.sleep(@interval)
end