Class: Celluloid::Actor::Sleeper
- Inherits:
-
Object
- Object
- Celluloid::Actor::Sleeper
- Defined in:
- lib/celluloid/actor.rb
Instance Method Summary collapse
- #before_suspend(task) ⇒ Object
-
#initialize(timers, interval) ⇒ Sleeper
constructor
A new instance of Sleeper.
- #wait ⇒ Object
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 |
#wait ⇒ Object
276 277 278 |
# File 'lib/celluloid/actor.rb', line 276 def wait Kernel.sleep(@interval) end |