Class: Discover::Service::Watcher

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/discover.rb

Instance Method Summary collapse

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

#doneObject



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

#waitObject



168
169
170
# File 'lib/discover.rb', line 168

def wait
  @condition.wait
end