Class: Bananajour::Bonjour::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/bananajour/bonjour/browser.rb

Overview

Generic bonjour browser

Example use:

browser = BonjourBrowser.new("_git._tcp,_bananajour")
loop do
  sleep(1)
  pp browser.replies.map {|r| r.name}
end

Probably gem-worthy

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ Browser

Returns a new instance of Browser.



20
21
22
23
24
25
# File 'lib/bananajour/bonjour/browser.rb', line 20

def initialize(service)
  @service = service
  @mutex = Mutex.new
  @replies = {}
  watch!
end

Instance Method Details

#repliesObject



26
27
28
# File 'lib/bananajour/bonjour/browser.rb', line 26

def replies
  @mutex.synchronize { @replies.values }
end