Sha256: 66cf1f5ab892740b40e7f8c2906cd3c59f77fc6668a94d9b1d6e2a3746467248
Contents?: true
Size: 1.3 KB
Versions: 4
Compression:
Stored size: 1.3 KB
Contents
module Net # :nodoc: module DNS class RR #------------------------------------------------------------ # RR type TXT #------------------------------------------------------------ class TXT < RR attr_reader :txt private def build_pack str = "" @txt.split(" ").each do |txt| str += [txt.length, txt].pack("C a*") end @txt_pack = str @rdlength = @txt_pack.size end def get_data @txt_pack end def subclass_new_from_hash(args) if args.key? :txt @txt = args[:txt].strip else raise ArgumentError, ":txt field is mandatory but missing" end end def subclass_new_from_string(str) @txt = str.strip end def subclass_new_from_binary(data, offset) off_end = offset + @rdlength @txt = "" while offset < off_end len = data.unpack("@#{offset} C")[0] offset += 1 str = data[offset..offset + len - 1] offset += len @txt << str << " " end offset end private def set_type @type = Net::DNS::RR::Types.new("TXT") end end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
gitlab-net-dns-0.10.0 | lib/net/dns/rr/txt.rb |
gitlab-net-dns-0.9.2 | lib/net/dns/rr/txt.rb |
gitlab-net-dns-0.9.1 | lib/net/dns/rr/txt.rb |
net-dns-0.9.0 | lib/net/dns/rr/txt.rb |