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

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

Constant Summary collapse

TypeValue =
15

Constants inherited from Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resolv::DNS::Resource

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

Constructor Details

#initialize(preference, exchange) ⇒ MX

Returns a new instance of MX.



1581
1582
1583
1584
# File 'lib/resolv.rb', line 1581

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

Instance Attribute Details

#exchangeObject (readonly)

Returns the value of attribute exchange



1585
1586
1587
# File 'lib/resolv.rb', line 1585

def exchange
  @exchange
end

#preferenceObject (readonly)

Returns the value of attribute preference



1585
1586
1587
# File 'lib/resolv.rb', line 1585

def preference
  @preference
end

Class Method Details

.decode_rdata(msg) ⇒ Object



1592
1593
1594
1595
1596
# File 'lib/resolv.rb', line 1592

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

Instance Method Details

#encode_rdata(msg) ⇒ Object



1587
1588
1589
1590
# File 'lib/resolv.rb', line 1587

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