Class: Discover::Service::Watcher
- Inherits:
-
Object
- Object
- Discover::Service::Watcher
- Includes:
- Celluloid
- Defined in:
- lib/discover.rb
Instance Method Summary collapse
- #done ⇒ Object
-
#initialize(block) ⇒ Watcher
constructor
A new instance of Watcher.
- #notify(update) ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize(block) ⇒ Watcher
Returns a new instance of Watcher.
147 148 149 150 |
# File 'lib/discover.rb', line 147 def initialize(block) @block = block @condition = Condition.new end |
Instance Method Details
#done ⇒ Object
156 157 158 |
# File 'lib/discover.rb', line 156 def done @condition.broadcast end |
#notify(update) ⇒ Object
152 153 154 |
# File 'lib/discover.rb', line 152 def notify(update) @block.call update end |
#wait ⇒ Object
160 161 162 |
# File 'lib/discover.rb', line 160 def wait @condition.wait end |