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