Class: RecordStore::Record::CNAME

Inherits:
RecordStore::Record show all
Defined in:
lib/record_store/record/cname.rb

Constant Summary

Constants inherited from RecordStore::Record

CNAME_REGEX, FQDN_REGEX

Instance Attribute Summary collapse

Attributes inherited from RecordStore::Record

#fqdn, #id, #ttl

Instance Method Summary collapse

Methods inherited from RecordStore::Record

#==, 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) ⇒ CNAME

Returns a new instance of CNAME.



12
13
14
15
# File 'lib/record_store/record/cname.rb', line 12

def initialize(record)
  super
  @cname = Record.ensure_ends_with_dot(record.fetch(:cname))
end

Instance Attribute Details

#cnameObject

Returns the value of attribute cname.



3
4
5
# File 'lib/record_store/record/cname.rb', line 3

def cname
  @cname
end

Instance Method Details

#rdataObject



17
18
19
# File 'lib/record_store/record/cname.rb', line 17

def rdata
  { cname: cname }
end

#rdata_txtObject



21
22
23
# File 'lib/record_store/record/cname.rb', line 21

def rdata_txt
  cname
end

#validate_circular_referenceObject



25
26
27
# File 'lib/record_store/record/cname.rb', line 25

def validate_circular_reference
  errors.add(:fqdn, 'A CNAME should not point to itself') unless fqdn != cname
end