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

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

Overview

Mail Exchanger resource.

Constant Summary collapse

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

#initialize(preference, exchange) ⇒ MX

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



1935
1936
1937
1938
# File 'lib/rubysl/resolv/resolv.rb', line 1935

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

Instance Attribute Details

#exchangeObject (readonly)

The host of this MX.



1948
1949
1950
# File 'lib/rubysl/resolv/resolv.rb', line 1948

def exchange
  @exchange
end

#preferenceObject (readonly)

The preference for this MX.



1943
1944
1945
# File 'lib/rubysl/resolv/resolv.rb', line 1943

def preference
  @preference
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



1955
1956
1957
1958
1959
# File 'lib/rubysl/resolv/resolv.rb', line 1955

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

Instance Method Details

#encode_rdata(msg) ⇒ Object

:nodoc:



1950
1951
1952
1953
# File 'lib/rubysl/resolv/resolv.rb', line 1950

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