Sha256: 16b4ec7252a0aa89d1224a6bf9f2c9ed537bbc2c4c53bb3e7983e21634d7d133

Contents?: true

Size: 552 Bytes

Versions: 44

Compression:

Stored size: 552 Bytes

Contents

module RecordStore
  class Record::A < Record
    attr_accessor :address

    validates_presence_of :address
    validate :valid_address?

    def initialize(record)
      super
      @address = record.fetch(:address)
    end

    def rdata
      { address: address }
    end

    def rdata_txt
      address
    end

    private

    def valid_address?
      ip = IPAddr.new(address)
      errors.add(:address, 'is not an IPv4 address') unless ip.ipv4?
    rescue IPAddr::InvalidAddressError
      errors.add(:address, 'is invalid')
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
record_store-6.5.1 lib/record_store/record/a.rb
record_store-6.5.0 lib/record_store/record/a.rb
record_store-6.4.1 lib/record_store/record/a.rb
record_store-6.4.0 lib/record_store/record/a.rb
record_store-6.3.1 lib/record_store/record/a.rb
record_store-6.3.0 lib/record_store/record/a.rb
record_store-6.2.1 lib/record_store/record/a.rb
record_store-6.2.0 lib/record_store/record/a.rb
record_store-6.1.2 lib/record_store/record/a.rb
record_store-6.1.1 lib/record_store/record/a.rb
record_store-6.1.0 lib/record_store/record/a.rb
record_store-6.0.1 lib/record_store/record/a.rb
record_store-6.0.0 lib/record_store/record/a.rb
record_store-5.11.0 lib/record_store/record/a.rb
record_store-5.10.0 lib/record_store/record/a.rb
record_store-5.9.0 lib/record_store/record/a.rb
record_store-5.8.0 lib/record_store/record/a.rb
record_store-5.7.4 lib/record_store/record/a.rb
record_store-5.7.3 lib/record_store/record/a.rb
record_store-5.7.2 lib/record_store/record/a.rb