Sha256: 20c794c77e3a4ca4c50a4a93d1751595e26e0a7fd638f3e1935720f028372138

Contents?: true

Size: 1.02 KB

Versions: 45

Compression:

Stored size: 1.02 KB

Contents

module RecordStore
  class Record::SRV < Record
    attr_accessor :priority, :port, :weight, :target

    validates :priority, presence: true, numericality:
      {
        only_integer: true,
        greater_than_or_equal_to: 0,
      }
    validates :port, presence: true, numericality:
      {
        only_integer: true,
        greater_than_or_equal_to: 0,
      }
    validates :weight, presence: true, numericality:
      {
        only_integer: true,
        greater_than_or_equal_to: 0,
      }
    validates :target, presence: true, format:
      {
        with: Record::CNAME_REGEX,
        message: 'is not a fully qualified domain name',
      }

    def initialize(record)
      super
      @priority = record.fetch(:priority)
      @weight   = record.fetch(:weight)
      @port     = record.fetch(:port)
      @target   = record.fetch(:target)
    end

    def rdata
      { priority: priority, port: port, weight: weight, target: target }
    end

    def rdata_txt
      "#{priority} #{weight} #{port} #{target}"
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

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