Class: Resolv::DNS::Resource

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

Overview

A DNS resource abstract class.

Direct Known Subclasses

DomainName, Generic, HINFO, IN::A, IN::AAAA, IN::SRV, IN::WKS, MINFO, MX, SOA, TXT

Defined Under Namespace

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

Constant Summary collapse

ClassHash =

:nodoc:

{}
ClassValue =

Standard (class generic) RRs

nil
ClassInsensitiveTypes =

:nodoc:

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ttlObject (readonly)

Remaining Time To Live for this Resource.



1514
1515
1516
# File 'lib/resolv.rb', line 1514

def ttl
  @ttl
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:

Raises:

  • (NotImplementedError)


1522
1523
1524
# File 'lib/resolv.rb', line 1522

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

.get_class(type_value, class_value) ⇒ Object

:nodoc:



1545
1546
1547
1548
# File 'lib/resolv.rb', line 1545

def self.get_class(type_value, class_value) # :nodoc:
  return ClassHash[[type_value, class_value]] ||
         Generic.create(type_value, class_value)
end

Instance Method Details

#==(other) ⇒ Object

:nodoc:



1526
1527
1528
1529
1530
1531
# File 'lib/resolv.rb', line 1526

def ==(other) # :nodoc:
  return self.class == other.class &&
    self.instance_variables == other.instance_variables &&
    self.instance_variables.collect {|name| self.instance_eval name} ==
      other.instance_variables.collect {|name| other.instance_eval name}
end

#encode_rdata(msg) ⇒ Object

:nodoc:

Raises:

  • (NotImplementedError)


1518
1519
1520
# File 'lib/resolv.rb', line 1518

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

#eql?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


1533
1534
1535
# File 'lib/resolv.rb', line 1533

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

#hashObject

:nodoc:



1537
1538
1539
1540
1541
1542
1543
# File 'lib/resolv.rb', line 1537

def hash # :nodoc:
  h = 0
  self.instance_variables.each {|name|
    h ^= self.instance_eval("#{name}.hash")
  }
  return h
end