class Net::DNS::RR::TXT

Attributes

txt[R]

Private Instance Methods

build_pack() click to toggle source
# File lib/net/dns/rr/txt.rb, line 12
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
get_data() click to toggle source
# File lib/net/dns/rr/txt.rb, line 21
def get_data
  @txt_pack
end
set_type() click to toggle source
# File lib/net/dns/rr/txt.rb, line 52
def set_type
  @type = Net::DNS::RR::Types.new("TXT")
end
subclass_new_from_binary(data, offset) click to toggle source
# File lib/net/dns/rr/txt.rb, line 37
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
subclass_new_from_hash(args) click to toggle source
# File lib/net/dns/rr/txt.rb, line 25
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
subclass_new_from_string(str) click to toggle source
# File lib/net/dns/rr/txt.rb, line 33
def subclass_new_from_string(str)
  @txt = str.strip
end