Class: Testjour::Bonjour::Server

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, host, port) ⇒ Server

Returns a new instance of Server.



18
19
20
21
22
# File 'lib/testjour/bonjour.rb', line 18

def initialize(name, host, port)
  @name = name
  @host = host
  @port = port
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



12
13
14
# File 'lib/testjour/bonjour.rb', line 12

def host
  @host
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/testjour/bonjour.rb', line 12

def name
  @name
end

#portObject (readonly)

Returns the value of attribute port.



12
13
14
# File 'lib/testjour/bonjour.rb', line 12

def port
  @port
end

Class Method Details

.from_dnssd(reply, rr) ⇒ Object



14
15
16
# File 'lib/testjour/bonjour.rb', line 14

def self.from_dnssd(reply, rr)
  new(reply.name, rr.target, rr.port)
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
# File 'lib/testjour/bonjour.rb', line 24

def ==(other)
  other.class == self.class && other.uri == self.uri
end

#status_lineObject



32
33
34
# File 'lib/testjour/bonjour.rb', line 32

def status_line
  "    %-12s %s %s" % [name, colored_status, "#{host}:#{port}"]
end

#uriObject



28
29
30
# File 'lib/testjour/bonjour.rb', line 28

def uri
  "druby://" + @host.gsub(/\.$/, "") + ":" + @port.to_s
end