Class: DNS::Zone::RR::TXT

Inherits:
Record
  • Object
show all
Defined in:
lib/dns/zone/rr/txt.rb

Overview

`A` resource record.

RFC 1035

Direct Known Subclasses

SPF

Instance Attribute Summary collapse

Attributes inherited from Record

#klass, #label, #ttl

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

#textObject

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

#dumpObject


8
9
10
11
12
# File 'lib/dns/zone/rr/txt.rb', line 8

def dump
  parts = general_prefix
  parts << %Q{"#{text}"}
  parts.join(' ')
end

#load(string, options = {}) ⇒ Object


14
15
16
17
18
19
20
# File 'lib/dns/zone/rr/txt.rb', line 14

def load(string, options = {})
  rdata = load_general_and_get_rdata(string, options)
  return nil unless rdata
  # extract text from within quotes; allow multiple quoted strings; ignore escaped quotes
  @text = rdata.scan(/"#{DNS::Zone::RR::REGEX_STRING}"/).join
  self
end