Class: DNS::Zone::RR::NAPTR
Overview
‘NAPTR` resource record.
RFC 3403
Constant Summary collapse
- REGEX_NAPTR_RDATA =
%r{ (?<order>\d+)\s* (?<pref>\d+)\s* (?<flags>#{DNS::Zone::RR::REGEX_CHARACTER_STRING})\s* (?<service>#{DNS::Zone::RR::REGEX_CHARACTER_STRING})\s* (?<regexp>#{DNS::Zone::RR::REGEX_CHARACTER_STRING})\s* (?<replacement>#{DNS::Zone::RR::REGEX_DOMAINNAME}|\.{1})\s* }mx
Instance Attribute Summary collapse
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#order ⇒ Object
Returns the value of attribute order.
-
#pref ⇒ Object
Returns the value of attribute pref.
-
#regexp ⇒ Object
Returns the value of attribute regexp.
-
#replacement ⇒ Object
Returns the value of attribute replacement.
-
#service ⇒ Object
Returns the value of attribute service.
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
#flags ⇒ Object
Returns the value of attribute flags.
15 16 17 |
# File 'lib/dns/zone/rr/naptr.rb', line 15 def flags @flags end |
#order ⇒ Object
Returns the value of attribute order.
15 16 17 |
# File 'lib/dns/zone/rr/naptr.rb', line 15 def order @order end |
#pref ⇒ Object
Returns the value of attribute pref.
15 16 17 |
# File 'lib/dns/zone/rr/naptr.rb', line 15 def pref @pref end |
#regexp ⇒ Object
Returns the value of attribute regexp.
15 16 17 |
# File 'lib/dns/zone/rr/naptr.rb', line 15 def regexp @regexp end |
#replacement ⇒ Object
Returns the value of attribute replacement.
15 16 17 |
# File 'lib/dns/zone/rr/naptr.rb', line 15 def replacement @replacement end |
#service ⇒ Object
Returns the value of attribute service.
15 16 17 |
# File 'lib/dns/zone/rr/naptr.rb', line 15 def service @service end |
Instance Method Details
#dump ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dns/zone/rr/naptr.rb', line 17 def dump parts = general_prefix parts << order parts << pref parts << %Q{"#{flags}"} parts << %Q{"#{service}"} parts << %Q{"#{regexp}"} parts << replacement parts.join(' ') end |
#load(string, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dns/zone/rr/naptr.rb', line 28 def load(string, = {}) rdata = load_general_and_get_rdata(string, ) return nil unless rdata captures = rdata.match(REGEX_NAPTR_RDATA) return nil unless captures @order = captures[:order].to_i @pref = captures[:pref].to_i @flags = captures[:flags].scan(/#{DNS::Zone::RR::REGEX_CHARACTER_STRING}/).join @service = captures[:service].scan(/#{DNS::Zone::RR::REGEX_CHARACTER_STRING}/).join @regexp = captures[:regexp].scan(/#{DNS::Zone::RR::REGEX_CHARACTER_STRING}/).join @replacement = captures[:replacement] self end |