Class: Testjour::Bonjour::Server
- Inherits:
-
Object
- Object
- Testjour::Bonjour::Server
- Defined in:
- lib/testjour/bonjour.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, host, port) ⇒ Server
constructor
A new instance of Server.
- #status_line ⇒ Object
- #uri ⇒ Object
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
#host ⇒ Object (readonly)
Returns the value of attribute host.
12 13 14 |
# File 'lib/testjour/bonjour.rb', line 12 def host @host end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/testjour/bonjour.rb', line 12 def name @name end |
#port ⇒ Object (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_line ⇒ Object
32 33 34 |
# File 'lib/testjour/bonjour.rb', line 32 def status_line " %-12s %s %s" % [name, colored_status, "#{host}:#{port}"] end |
#uri ⇒ Object
28 29 30 |
# File 'lib/testjour/bonjour.rb', line 28 def uri "druby://" + @host.gsub(/\.$/, "") + ":" + @port.to_s end |