Class: Easyjour::Service
- Inherits:
-
Object
- Object
- Easyjour::Service
- Defined in:
- lib/easyjour.rb
Instance Method Summary collapse
-
#initialize(name, service, port, text_record_hash = {}, protocol = :tcp) ⇒ Service
constructor
A new instance of Service.
-
#stop ⇒ Object
Stops a service from being discoverable.
Constructor Details
#initialize(name, service, port, text_record_hash = {}, protocol = :tcp) ⇒ Service
Returns a new instance of Service.
25 26 27 28 29 30 31 32 33 |
# File 'lib/easyjour.rb', line 25 def initialize(name, service, port, text_record_hash = {}, protocol = :tcp) text_record = DNSSD::TextRecord.new text_record_hash.each do |key, value| text_record[key] = value end @service = DNSSD.register(name, Easyjour.type_from_parts(service, protocol), 'local', port, text_record.encode, DNSSD::Flags::Add) do |reply| end end |
Instance Method Details
#stop ⇒ Object
Stops a service from being discoverable.
36 37 38 |
# File 'lib/easyjour.rb', line 36 def stop @service.stop end |