Class: Resolv::DNS::Resource

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

Overview

A DNS resource abstract class.

Defined Under Namespace

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

Constant Summary

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

- (Object) ttl (readonly)

Remaining Time To Live for this Resource.



1550
1551
1552
# File 'lib/resolv.rb', line 1550

def ttl
  @ttl
end

Class Method Details

+ (Object) decode_rdata(msg)

:nodoc:

Raises:

  • (NotImplementedError)


1558
1559
1560
# File 'lib/resolv.rb', line 1558

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

+ (Object) get_class(type_value, class_value)

:nodoc:



1589
1590
1591
1592
# File 'lib/resolv.rb', line 1589

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

- (Object) ==(other)

:nodoc:



1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
# File 'lib/resolv.rb', line 1562

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

- (Object) encode_rdata(msg)

:nodoc:

Raises:

  • (NotImplementedError)


1554
1555
1556
# File 'lib/resolv.rb', line 1554

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

- (Boolean) eql?(other)

:nodoc:

Returns:

  • (Boolean)


1575
1576
1577
# File 'lib/resolv.rb', line 1575

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

- (Object) hash

:nodoc:



1579
1580
1581
1582
1583
1584
1585
1586
1587
# File 'lib/resolv.rb', line 1579

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