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.
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 |
#wait ⇒ Object
270 271 272 |
# File 'lib/celluloid/actor.rb', line 270 def wait Kernel.sleep(@interval) end |