Sha256: e667e647916013ee6744f068badc8abc8063f43dfcf531af8f7f67b9a0d90b6e

Contents?: true

Size: 727 Bytes

Versions: 45

Compression:

Stored size: 727 Bytes

Contents

module RecordStore
  class Record::MX < Record
    attr_accessor :exchange, :preference

    validates :preference, presence: true, numericality:
      {
        only_integer: true,
        greater_than_or_equal_to: 0,
      }
    validates :exchange, presence: true, format:
      {
        with: Record::FQDN_REGEX,
        message: 'is not a fully qualified domain name',
      }

    def initialize(record)
      super
      @exchange = Record.ensure_ends_with_dot(record.fetch(:exchange))
      @preference = Integer(record.fetch(:preference))
    end

    def rdata
      {
        preference: preference,
        exchange: exchange,
      }
    end

    def rdata_txt
      "#{preference} #{exchange}"
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
record_store-8.0.4 lib/record_store/record/mx.rb
record_store-8.0.3 lib/record_store/record/mx.rb
record_store-8.0.2 lib/record_store/record/mx.rb
record_store-8.0.1 lib/record_store/record/mx.rb
record_store-8.0.0 lib/record_store/record/mx.rb
record_store-7.1.1 lib/record_store/record/mx.rb
record_store-7.1.0 lib/record_store/record/mx.rb
record_store-7.0.1 lib/record_store/record/mx.rb
record_store-7.0.0 lib/record_store/record/mx.rb
record_store-6.7.2 lib/record_store/record/mx.rb
record_store-6.7.1 lib/record_store/record/mx.rb
record_store-6.7.0 lib/record_store/record/mx.rb
record_store-6.6.0 lib/record_store/record/mx.rb
record_store-6.5.11 lib/record_store/record/mx.rb
record_store-6.5.10 lib/record_store/record/mx.rb
record_store-6.5.9 lib/record_store/record/mx.rb
record_store-6.5.8 lib/record_store/record/mx.rb
record_store-6.5.5 lib/record_store/record/mx.rb
record_store-6.5.4 lib/record_store/record/mx.rb
record_store-6.5.3 lib/record_store/record/mx.rb