Class: Resolv::DNS::Resource::MX

Inherits:
Resolv::DNS::Resource show all
Defined in:
lib/resolv.rb

Overview

Mail Exchanger resource.

Constant Summary

TypeValue =

:nodoc:

15

Constants inherited from Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary (collapse)

Attributes inherited from Resolv::DNS::Resource

#ttl

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Resolv::DNS::Resource

#==, #eql?, get_class, #hash

Constructor Details

- (MX) initialize(preference, exchange)

Creates a new MX record with preference, accepting mail at exchange.



1836
1837
1838
1839
# File 'lib/resolv.rb', line 1836

def initialize(preference, exchange)
  @preference = preference
  @exchange = exchange
end

Instance Attribute Details

- (Object) exchange (readonly)

The host of this MX.



1849
1850
1851
# File 'lib/resolv.rb', line 1849

def exchange
  @exchange
end

- (Object) preference (readonly)

The preference for this MX.



1844
1845
1846
# File 'lib/resolv.rb', line 1844

def preference
  @preference
end

Class Method Details

+ (Object) decode_rdata(msg)

:nodoc:



1856
1857
1858
1859
1860
# File 'lib/resolv.rb', line 1856

def self.decode_rdata(msg) # :nodoc:
  preference, = msg.get_unpack('n')
  exchange = msg.get_name
  return self.new(preference, exchange)
end

Instance Method Details

- (Object) encode_rdata(msg)

:nodoc:



1851
1852
1853
1854
# File 'lib/resolv.rb', line 1851

def encode_rdata(msg) # :nodoc:
  msg.put_pack('n', @preference)
  msg.put_name(@exchange)
end