Sha256: 9d4ce92ecbb673601b9f447815a1bf2aec51df07b6e68dd648226cdc2c095654

Contents?: true

Size: 629 Bytes

Versions: 7

Compression:

Stored size: 629 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 to_s
      "[ALIASRecord] #{fqdn} #{ttl} IN ALIAS #{self.alias}"
    end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
record_store-4.0.7 lib/record_store/record/alias.rb
record_store-4.0.6 lib/record_store/record/alias.rb
record_store-4.0.5 lib/record_store/record/alias.rb
record_store-4.0.4 lib/record_store/record/alias.rb
record_store-4.0.3 lib/record_store/record/alias.rb
record_store-4.0.2 lib/record_store/record/alias.rb
record_store-4.0.1 lib/record_store/record/alias.rb