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.



1605
1606
1607
# File 'lib/resolv.rb', line 1605

def ttl
  @ttl
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:

Raises:

  • (NotImplementedError)


1613
1614
1615
# File 'lib/resolv.rb', line 1613

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

.get_class(type_value, class_value) ⇒ Object

:nodoc:



1644
1645
1646
1647
# File 'lib/resolv.rb', line 1644

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:



1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
# File 'lib/resolv.rb', line 1617

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)


1609
1610
1611
# File 'lib/resolv.rb', line 1609

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

#eql?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


1630
1631
1632
# File 'lib/resolv.rb', line 1630

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

#hashObject

:nodoc:



1634
1635
1636
1637
1638
1639
1640
1641
1642
# File 'lib/resolv.rb', line 1634

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