Class: DNS::Zone::RR::MX
Overview
‘MX` resource record.
RFC 1035
Constant Summary collapse
- REGEX_MX_RDATA =
%r{ (?<priority>\d+)\s* (?<exchange>#{DNS::Zone::RR::REGEX_DOMAINNAME})\s* }mx
Instance Attribute Summary collapse
-
#exchange ⇒ Object
Returns the value of attribute exchange.
-
#priority ⇒ Object
Returns the value of attribute priority.
Attributes inherited from Record
Instance Method Summary collapse
Methods inherited from Record
#general_prefix, #initialize, #load_general_and_get_rdata, #type
Constructor Details
This class inherits a constructor from DNS::Zone::RR::Record
Instance Attribute Details
#exchange ⇒ Object
Returns the value of attribute exchange.
12 13 14 |
# File 'lib/dns/zone/rr/mx.rb', line 12 def exchange @exchange end |
#priority ⇒ Object
Returns the value of attribute priority.
11 12 13 |
# File 'lib/dns/zone/rr/mx.rb', line 11 def priority @priority end |
Instance Method Details
#dump ⇒ Object
14 15 16 17 18 19 |
# File 'lib/dns/zone/rr/mx.rb', line 14 def dump parts = general_prefix parts << priority parts << exchange parts.join(' ') end |
#load(string, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dns/zone/rr/mx.rb', line 21 def load(string, = {}) rdata = load_general_and_get_rdata(string, ) return nil unless rdata captures = rdata.match(REGEX_MX_RDATA) return nil unless captures @priority = captures[:priority].to_i @exchange = captures[:exchange] self end |