Class: DNS::Zone::RR::SRV
Overview
‘SRV` resource record.
RFC 2782
Constant Summary collapse
- REGEX_SRV_RDATA =
%r{ (?<priority>\d+)\s* (?<weight>\d+)\s* (?<port>\d+)\s* (?<target>#{DNS::Zone::RR::REGEX_DOMAINNAME})\s* }mx
Instance Attribute Summary collapse
-
#port ⇒ Object
Returns the value of attribute port.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#target ⇒ Object
Returns the value of attribute target.
-
#weight ⇒ Object
Returns the value of attribute weight.
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
#port ⇒ Object
Returns the value of attribute port.
13 14 15 |
# File 'lib/dns/zone/rr/srv.rb', line 13 def port @port end |
#priority ⇒ Object
Returns the value of attribute priority.
13 14 15 |
# File 'lib/dns/zone/rr/srv.rb', line 13 def priority @priority end |
#target ⇒ Object
Returns the value of attribute target.
13 14 15 |
# File 'lib/dns/zone/rr/srv.rb', line 13 def target @target end |
#weight ⇒ Object
Returns the value of attribute weight.
13 14 15 |
# File 'lib/dns/zone/rr/srv.rb', line 13 def weight @weight end |
Instance Method Details
#dump ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/dns/zone/rr/srv.rb', line 15 def dump parts = general_prefix parts << priority parts << weight parts << port parts << target parts.join(' ') end |
#load(string, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dns/zone/rr/srv.rb', line 24 def load(string, = {}) rdata = load_general_and_get_rdata(string, ) return nil unless rdata captures = rdata.match(REGEX_SRV_RDATA) return nil unless captures @priority = captures[:priority].to_i @weight = captures[:weight].to_i @port = captures[:port].to_i @target = captures[:target] self end |