Class: Resolv::DNS::Resource

Inherits:
Query
  • Object
show all
Defined in:
lib/resolv.rb

Overview

A DNS resource abstract class.

Direct Known Subclasses

IN::A, IN::AAAA, IN::SRV, IN::WKS

Defined Under Namespace

Modules: IN Classes: ANY, CAA, CNAME, DomainName, Generic, HINFO, LOC, MINFO, MX, NS, PTR, SOA, TXT

Constant Summary collapse

ClassHash =
Module.new do
  module_function

  def []=(type_class_value, klass)
    type_value, class_value = type_class_value
    Resource.const_set(:"Type#{type_value}_Class#{class_value}", klass)
  end
end
ClassValue =

Standard (class generic) RRs

nil
ClassInsensitiveTypes =

:nodoc:

[ # :nodoc:
  NS, CNAME, SOA, PTR, HINFO, MINFO, MX, TXT, LOC, ANY, CAA
]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ttlObject (readonly)

Remaining Time To Live for this Resource.



2203
2204
2205
# File 'lib/resolv.rb', line 2203

def ttl
  @ttl
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:

Raises:

  • (NotImplementedError)


2218
2219
2220
# File 'lib/resolv.rb', line 2218

def self.decode_rdata(msg) # :nodoc:
  raise NotImplementedError.new
end

.get_class(type_value, class_value) ⇒ Object

:nodoc:



2249
2250
2251
2252
2253
2254
# File 'lib/resolv.rb', line 2249

def self.get_class(type_value, class_value) # :nodoc:
  cache = :"Type#{type_value}_Class#{class_value}"

  return (const_defined?(cache) && const_get(cache)) ||
         Generic.create(type_value, class_value)
end

Instance Method Details

#==(other) ⇒ Object

:nodoc:



2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
# File 'lib/resolv.rb', line 2222

def ==(other) # :nodoc:
  return false unless self.class == other.class
  s_ivars = self.instance_variables
  s_ivars.sort!
  s_ivars.delete :@ttl
  o_ivars = other.instance_variables
  o_ivars.sort!
  o_ivars.delete :@ttl
  return s_ivars == o_ivars &&
    s_ivars.collect {|name| self.instance_variable_get name} ==
      o_ivars.collect {|name| other.instance_variable_get name}
end

#encode_rdata(msg) ⇒ Object

:nodoc:

Raises:

  • (NotImplementedError)


2214
2215
2216
# File 'lib/resolv.rb', line 2214

def encode_rdata(msg) # :nodoc:
  raise NotImplementedError.new
end

#eql?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


2235
2236
2237
# File 'lib/resolv.rb', line 2235

def eql?(other) # :nodoc:
  return self == other
end

#hashObject

:nodoc:



2239
2240
2241
2242
2243
2244
2245
2246
2247
# File 'lib/resolv.rb', line 2239

def hash # :nodoc:
  h = 0
  vars = self.instance_variables
  vars.delete :@ttl
  vars.each {|name|
    h ^= self.instance_variable_get(name).hash
  }
  return h
end