Class: DNS::Zone::RR::TXT
Overview
‘A` resource record.
RFC 1035
Direct Known Subclasses
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
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
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/dns/zone/rr/txt.rb', line 6 def text @text end |
Instance Method Details
#dump ⇒ Object
8 9 10 11 12 |
# File 'lib/dns/zone/rr/txt.rb', line 8 def dump parts = general_prefix parts << text parts.join(' ') end |
#load(string, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/dns/zone/rr/txt.rb', line 14 def load(string, = {}) rdata = load_general_and_get_rdata(string, ) return nil unless rdata # extract text from within quotes; allow multiple quoted strings; ignore escaped quotes # @text = rdata.scan(/"#{DNS::Zone::RR::REGEX_STRING}"/).flatten.map { |w| %Q{"#{w}"} }.join @text = rdata.scan(/"#{DNS::Zone::RR::REGEX_STRING}"/).flat_map { |w| %Q{"#{w&.first}"} }.join(' ') self end |