Sha256: 7e8a3a16a987c5fcfc2dbf4fa626c2fe8a48b7d0283966f30205bd35061606a7
Contents?: true
Size: 617 Bytes
Versions: 16
Compression:
Stored size: 617 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 to_s "[ARecord] #{fqdn} #{ttl} IN A #{address}" end def rdata { address: address } end private def valid_address? begin ip = IPAddr.new(address) errors.add(:address, 'is not an IPv4 address') unless ip.ipv4? rescue IPAddr::InvalidAddressError => e errors.add(:address, 'is invalid') end end end end
Version data entries
16 entries across 16 versions & 1 rubygems