Class: RecordStore::Record::PTR
Constant Summary
collapse
- OCTET_LABEL_SEQUENCE_REGEX =
/\A(?:([0-9]|[1-9][0-9]|[1-9][0-9][0-9])\.){1,4}/
- IN_ADDR_ARPA_SUFFIX_REGEX =
/in-addr\.arpa\.\z/
- FQDN_FORMAT_REGEX =
Regexp.new(OCTET_LABEL_SEQUENCE_REGEX.source + IN_ADDR_ARPA_SUFFIX_REGEX.source)
CNAME_REGEX, FQDN_REGEX
Instance Attribute Summary collapse
#fqdn, #id, #ttl
Instance Method Summary
collapse
#==, build_from_yaml_definition, ensure_ends_with_dot, ensure_ends_without_dot, escape, #hash, #key, #log!, long_quote, needs_long_quotes?, quote, #to_hash, #to_json, #to_s, #type, unescape, unlong_quote, unquote, #wildcard?
Constructor Details
#initialize(record) ⇒ PTR
Returns a new instance of PTR.
14
15
16
17
18
|
# File 'lib/record_store/record/ptr.rb', line 14
def initialize(record)
super
@ptrdname = Record.ensure_ends_with_dot(record.fetch(:ptrdname))
end
|
Instance Attribute Details
#ptrdname ⇒ Object
Returns the value of attribute ptrdname.
3
4
5
|
# File 'lib/record_store/record/ptr.rb', line 3
def ptrdname
@ptrdname
end
|
Instance Method Details
#rdata ⇒ Object
20
21
22
|
# File 'lib/record_store/record/ptr.rb', line 20
def rdata
{ ptrdname: ptrdname }
end
|
#rdata_txt ⇒ Object
24
25
26
|
# File 'lib/record_store/record/ptr.rb', line 24
def rdata_txt
ptrdname.to_s
end
|
#validate_fqdn_is_in_addr_arpa_subzone ⇒ Object
36
37
38
39
40
|
# File 'lib/record_store/record/ptr.rb', line 36
def validate_fqdn_is_in_addr_arpa_subzone
unless IN_ADDR_ARPA_SUFFIX_REGEX.match?(fqdn)
errors.add(:fqdn, 'PTR records may only exist in the in-addr.arpa zone')
end
end
|
#validate_fqdn_octets_in_range ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/record_store/record/ptr.rb', line 28
def validate_fqdn_octets_in_range
OCTET_LABEL_SEQUENCE_REGEX.match(fqdn) do |m|
unless m.captures.all? { |o| o.to_d.between?(0, 255) }
errors.add(:fqdn, 'octet labels must be within the range 0-255')
end
end
end
|