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-6.5.2 lib/record_store/record/mx.rb
record_store-6.5.1 lib/record_store/record/mx.rb
record_store-6.5.0 lib/record_store/record/mx.rb
record_store-6.4.1 lib/record_store/record/mx.rb
record_store-6.4.0 lib/record_store/record/mx.rb
record_store-6.3.1 lib/record_store/record/mx.rb
record_store-6.3.0 lib/record_store/record/mx.rb
record_store-6.2.1 lib/record_store/record/mx.rb
record_store-6.2.0 lib/record_store/record/mx.rb
record_store-6.1.2 lib/record_store/record/mx.rb
record_store-6.1.1 lib/record_store/record/mx.rb
record_store-6.1.0 lib/record_store/record/mx.rb
record_store-6.0.1 lib/record_store/record/mx.rb
record_store-6.0.0 lib/record_store/record/mx.rb
record_store-5.11.0 lib/record_store/record/mx.rb
record_store-5.10.0 lib/record_store/record/mx.rb
record_store-5.9.0 lib/record_store/record/mx.rb
record_store-5.8.0 lib/record_store/record/mx.rb
record_store-5.7.4 lib/record_store/record/mx.rb
record_store-5.7.3 lib/record_store/record/mx.rb