Class: Dnsruby::Cache::CacheKey
- Inherits:
-
Object
- Object
- Dnsruby::Cache::CacheKey
- Defined in:
- lib/dnsruby/cache.rb
Overview
:nodoc: all
Instance Attribute Summary collapse
-
#qclass ⇒ Object
Returns the value of attribute qclass.
-
#qname ⇒ Object
Returns the value of attribute qname.
-
#qtype ⇒ Object
Returns the value of attribute qtype.
Instance Method Summary collapse
-
#initialize(*args) ⇒ CacheKey
constructor
A new instance of CacheKey.
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ CacheKey
Returns a new instance of CacheKey.
288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/dnsruby/cache.rb', line 288 def initialize(*args) self.qclass = Classes.IN if (args.length > 0) self.qname = Name.create(args[0]) self.qname.absolute = true if (args.length > 1) self.qtype = Types.new(args[1]) if (args.length > 2) self.qclass = Classes.new(args[2]) end end end end |
Instance Attribute Details
#qclass ⇒ Object
Returns the value of attribute qclass.
287 288 289 |
# File 'lib/dnsruby/cache.rb', line 287 def qclass @qclass end |
#qname ⇒ Object
Returns the value of attribute qname.
287 288 289 |
# File 'lib/dnsruby/cache.rb', line 287 def qname @qname end |
#qtype ⇒ Object
Returns the value of attribute qtype.
287 288 289 |
# File 'lib/dnsruby/cache.rb', line 287 def qtype @qtype end |
Instance Method Details
#to_s ⇒ Object
301 302 303 304 305 306 |
# File 'lib/dnsruby/cache.rb', line 301 def to_s # Numeric presentation spellings (TYPE1, TYPE0001, CLASS1, ...) are # aliases of the same wire values, including when a decoded answer # uses the registered mnemonics instead of the query's spelling. return "#{qname.inspect.downcase} #{qclass.code} #{qtype.code}" end |