Module: Net::DNS::MDNS::QueryImp
Overview
An mDNS query implementation.
Constant Summary
Constants included from Net::DNS
DecodeError, Net::DNS::Message, Name
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The query
name
from Query.new. -
#type ⇒ Object
readonly
The query
type
from Query.new.
Instance Method Summary collapse
-
#each ⇒ Object
Loop forever, yielding answers as available.
- #initialize_(name, type = IN::ANY) ⇒ Object
-
#length ⇒ Object
Number of waiting answers.
-
#pop ⇒ Object
Block, returning answers when available.
-
#push(answers) ⇒ Object
:nodoc:.
- #stop ⇒ Object
-
#subscribes_to?(an) ⇒ Boolean
:nodoc:.
-
#to_s ⇒ Object
A string describing this query.
Methods included from Net::DNS
Instance Attribute Details
#name ⇒ Object (readonly)
The query name
from Query.new.
865 866 867 |
# File 'lib/net/dns/mdns.rb', line 865 def name @name end |
#type ⇒ Object (readonly)
The query type
from Query.new.
867 868 869 |
# File 'lib/net/dns/mdns.rb', line 867 def type @type end |
Instance Method Details
#each ⇒ Object
Loop forever, yielding answers as available.
875 876 877 878 879 |
# File 'lib/net/dns/mdns.rb', line 875 def each # :yield: answers loop do yield pop end end |
#initialize_(name, type = IN::ANY) ⇒ Object
891 892 893 894 895 896 897 898 899 |
# File 'lib/net/dns/mdns.rb', line 891 def initialize_(name, type = IN::ANY) @name = Name.create(name) @type = type @queue = Queue.new qu = @name != "*" ? Question.new(@name, @type) : nil Responder.instance.query_start(self, qu) end |
#length ⇒ Object
Number of waiting answers.
882 883 884 |
# File 'lib/net/dns/mdns.rb', line 882 def length @queue.length end |
#pop ⇒ Object
Block, returning answers when available.
870 871 872 |
# File 'lib/net/dns/mdns.rb', line 870 def pop @queue.pop end |
#push(answers) ⇒ Object
:nodoc:
859 860 861 862 |
# File 'lib/net/dns/mdns.rb', line 859 def push(answers) # :nodoc: @queue.push(answers) if answers.first self end |
#stop ⇒ Object
901 902 903 904 |
# File 'lib/net/dns/mdns.rb', line 901 def stop Responder.instance.query_stop(self) self end |