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.
155 156 157 158 |
# File 'lib/discover.rb', line 155 def initialize(block) @block = block @condition = Condition.new end |
Instance Method Details
#done ⇒ Object
164 165 166 |
# File 'lib/discover.rb', line 164 def done @condition.broadcast end |
#notify(update) ⇒ Object
160 161 162 |
# File 'lib/discover.rb', line 160 def notify(update) @block.call update end |
#wait ⇒ Object
168 169 170 |
# File 'lib/discover.rb', line 168 def wait @condition.wait end |