Sha256: d4f9d18425d81a499c7b66cecafff837fce89e2153b39fdce289ca84478873d9

Contents?: true

Size: 616 Bytes

Versions: 13

Compression:

Stored size: 616 Bytes

Contents

module RecordStore
  class Record::ALIAS < Record
    attr_accessor :alias

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

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

    def rdata
      { alias: self.alias }
    end

    def rdata_txt
      self.alias
    end

    def validate_circular_reference
      errors.add(:fqdn, 'An ALIAS should not point to itself') if fqdn == @alias
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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