Sha256: de69bfce1af53bcf610035316f89a521b6882259e7f45cf3e3dd7e451ffee47f
Contents?: true
Size: 582 Bytes
Versions: 16
Compression:
Stored size: 582 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? begin 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 end
Version data entries
16 entries across 16 versions & 1 rubygems