Class: DNS::Zone::RR::SOA

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

Overview

`SRV` resource record.

RFC 1035

Constant Summary collapse

REGEX_SOA_RDATA =
%r{
  (?<nameserver>#{DNS::Zone::RR::REGEX_DOMAINNAME})\s* # get nameserver domainname
  (?<email>#{DNS::Zone::RR::REGEX_DOMAINNAME})\s*      # get mailbox domainname
  (?<serial>\d+)\s*
  (?<refresh_ttl>#{DNS::Zone::RR::REGEX_TTL})\s*
  (?<retry_ttl>#{DNS::Zone::RR::REGEX_TTL})\s*
  (?<expiry_ttl>#{DNS::Zone::RR::REGEX_TTL})\s*
  (?<minimum_ttl>#{DNS::Zone::RR::REGEX_TTL})\s*
}mx

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

#emailObject

Returns the value of attribute email


16
17
18
# File 'lib/dns/zone/rr/soa.rb', line 16

def email
  @email
end

#expiry_ttlObject

Returns the value of attribute expiry_ttl


16
17
18
# File 'lib/dns/zone/rr/soa.rb', line 16

def expiry_ttl
  @expiry_ttl
end

#minimum_ttlObject

Returns the value of attribute minimum_ttl


16
17
18
# File 'lib/dns/zone/rr/soa.rb', line 16

def minimum_ttl
  @minimum_ttl
end

#nameserverObject

Returns the value of attribute nameserver


16
17
18
# File 'lib/dns/zone/rr/soa.rb', line 16

def nameserver
  @nameserver
end

#refresh_ttlObject

Returns the value of attribute refresh_ttl


16
17
18
# File 'lib/dns/zone/rr/soa.rb', line 16

def refresh_ttl
  @refresh_ttl
end

#retry_ttlObject

Returns the value of attribute retry_ttl


16
17
18
# File 'lib/dns/zone/rr/soa.rb', line 16

def retry_ttl
  @retry_ttl
end

#serialObject

Returns the value of attribute serial


16
17
18
# File 'lib/dns/zone/rr/soa.rb', line 16

def serial
  @serial
end

Instance Method Details

#dumpObject


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dns/zone/rr/soa.rb', line 18

def dump
  parts = general_prefix
  parts << nameserver
  parts << email

  parts << '('
  parts << serial
  parts << refresh_ttl
  parts << retry_ttl
  parts << expiry_ttl
  parts << minimum_ttl
  parts << ')'
  parts.join(' ')
end

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


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dns/zone/rr/soa.rb', line 33

def load(string, options = {})
  rdata = load_general_and_get_rdata(string, options)
  return nil unless rdata

  captures = rdata.match(REGEX_SOA_RDATA)
  return nil unless captures

  @nameserver = captures[:nameserver]
  @email = captures[:email]
  @serial = captures[:serial].to_i
  @refresh_ttl = captures[:refresh_ttl]
  @retry_ttl = captures[:retry_ttl]
  @expiry_ttl = captures[:expiry_ttl]
  @minimum_ttl = captures[:minimum_ttl]

  self
end