Sha256: 7eb67437c1cea59c780ab8ee454bb58e2c6cccb4d231564ad6725d04d745757e

Contents?: true

Size: 686 Bytes

Versions: 16

Compression:

Stored size: 686 Bytes

Contents

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

    validates :preference, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, presence: true
    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 = record.fetch(:preference)
    end

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

    def to_s
      "[MXRecord] #{fqdn} #{ttl} IN MX #{preference} #{exchange}"
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
record_store-4.0.7 lib/record_store/record/mx.rb
record_store-4.0.6 lib/record_store/record/mx.rb
record_store-4.0.5 lib/record_store/record/mx.rb
record_store-4.0.4 lib/record_store/record/mx.rb
record_store-4.0.3 lib/record_store/record/mx.rb
record_store-4.0.2 lib/record_store/record/mx.rb
record_store-4.0.1 lib/record_store/record/mx.rb
record_store-4.0.0 lib/record_store/record/mx.rb
record_store-3.1.4 lib/record_store/record/mx.rb
record_store-3.1.3 lib/record_store/record/mx.rb
record_store-3.1.1 lib/record_store/record/mx.rb
record_store-3.1.0 lib/record_store/record/mx.rb
record_store-3.0.0 lib/record_store/record/mx.rb
record_store-2.1.0 lib/record_store/record/mx.rb
record_store-2.0.0 lib/record_store/record/mx.rb
record_store-1.0.0 lib/record_store/record/mx.rb