Class: Resolv::DNS::Resource

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

Overview

A DNS resource abstract class.

Direct Known Subclasses

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

Defined Under Namespace

Modules: IN Classes: ANY, CNAME, DomainName, Generic, HINFO, LOC, 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, LOC, 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.



1663
1664
1665
# File 'lib/rubysl/resolv/resolv.rb', line 1663

def ttl
  @ttl
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:

Raises:

  • (NotImplementedError)


1671
1672
1673
# File 'lib/rubysl/resolv/resolv.rb', line 1671

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

.get_class(type_value, class_value) ⇒ Object

:nodoc:



1702
1703
1704
1705
# File 'lib/rubysl/resolv/resolv.rb', line 1702

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:



1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
# File 'lib/rubysl/resolv/resolv.rb', line 1675

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)


1667
1668
1669
# File 'lib/rubysl/resolv/resolv.rb', line 1667

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

#eql?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


1688
1689
1690
# File 'lib/rubysl/resolv/resolv.rb', line 1688

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

#hashObject

:nodoc:



1692
1693
1694
1695
1696
1697
1698
1699
1700
# File 'lib/rubysl/resolv/resolv.rb', line 1692

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