Sha256: f764675c18d54870a7f1c801f7a3c902f92d3f49ba5d00ca187aceab9e66a8b3

Contents?: true

Size: 604 Bytes

Versions: 12

Compression:

Stored size: 604 Bytes

Contents

module RecordStore
  class Record::CNAME < Record
    attr_accessor :cname

    validates :cname, presence: true, format:
      {
        with: Record::CNAME_REGEX,
        message: 'is not a fully qualified domain name',
      }
    validate :validate_circular_reference

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

    def rdata
      { cname: cname }
    end

    def rdata_txt
      cname
    end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
record_store-8.0.4 lib/record_store/record/cname.rb
record_store-8.0.3 lib/record_store/record/cname.rb
record_store-8.0.2 lib/record_store/record/cname.rb
record_store-8.0.1 lib/record_store/record/cname.rb
record_store-8.0.0 lib/record_store/record/cname.rb
record_store-7.1.1 lib/record_store/record/cname.rb
record_store-7.1.0 lib/record_store/record/cname.rb
record_store-7.0.1 lib/record_store/record/cname.rb
record_store-7.0.0 lib/record_store/record/cname.rb
record_store-6.7.2 lib/record_store/record/cname.rb
record_store-6.7.1 lib/record_store/record/cname.rb
record_store-6.7.0 lib/record_store/record/cname.rb