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

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

Overview

Mail Exchanger resource.

Constant Summary collapse

TypeValue =

:nodoc:

15

Constants inherited from Gem::Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary collapse

Attributes inherited from Gem::Resolv::DNS::Resource

#ttl

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gem::Resolv::DNS::Resource

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

Constructor Details

#initialize(preference, exchange) ⇒ MX

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



2382
2383
2384
2385
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2382

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

Instance Attribute Details

#exchangeObject (readonly)

The host of this MX.



2395
2396
2397
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2395

def exchange
  @exchange
end

#preferenceObject (readonly)

The preference for this MX.



2390
2391
2392
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2390

def preference
  @preference
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



2402
2403
2404
2405
2406
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2402

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:



2397
2398
2399
2400
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2397

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