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.



147
148
149
150
# File 'lib/discover.rb', line 147

def initialize(block)
  @block     = block
  @condition = Condition.new
end

Instance Method Details

#doneObject



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

#waitObject



160
161
162
# File 'lib/discover.rb', line 160

def wait
  @condition.wait
end