Sha256: a5b155b6ae6ad751994addb7e987e9760e9dfd1c9b486c196aef3ea856540303

Contents?: true

Size: 620 Bytes

Versions: 33

Compression:

Stored size: 620 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') unless fqdn != @alias
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

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