Sha256: e9c1e0ff371d88b964ff48d1b3d3cdead9bf4bf888ae5dc5d75d4114ac23afa4

Contents?: true

Size: 608 Bytes

Versions: 33

Compression:

Stored size: 608 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') unless fqdn != cname
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
record_store-6.6.0 lib/record_store/record/cname.rb
record_store-6.5.11 lib/record_store/record/cname.rb
record_store-6.5.10 lib/record_store/record/cname.rb
record_store-6.5.9 lib/record_store/record/cname.rb
record_store-6.5.8 lib/record_store/record/cname.rb
record_store-6.5.5 lib/record_store/record/cname.rb
record_store-6.5.4 lib/record_store/record/cname.rb
record_store-6.5.3 lib/record_store/record/cname.rb
record_store-6.5.2 lib/record_store/record/cname.rb
record_store-6.5.1 lib/record_store/record/cname.rb
record_store-6.5.0 lib/record_store/record/cname.rb
record_store-6.4.1 lib/record_store/record/cname.rb
record_store-6.4.0 lib/record_store/record/cname.rb
record_store-6.3.1 lib/record_store/record/cname.rb
record_store-6.3.0 lib/record_store/record/cname.rb
record_store-6.2.1 lib/record_store/record/cname.rb
record_store-6.2.0 lib/record_store/record/cname.rb
record_store-6.1.2 lib/record_store/record/cname.rb
record_store-6.1.1 lib/record_store/record/cname.rb
record_store-6.1.0 lib/record_store/record/cname.rb