Class: ReDNS::Record::Null

Inherits:
Fragment show all
Defined in:
lib/redns/record/null.rb

Direct Known Subclasses

TXT

Instance Attribute Summary

Attributes inherited from Fragment

#attributes

Instance Method Summary collapse

Methods inherited from Fragment

attribute, #initialize

Methods included from Support

#addr_to_arpa, #bind_all_addr, #default_nameservers, #default_resolver_address, #dns_port, #inet_aton, #inet_ntoa, #io_nonblock, #io_nonblock?, #io_set_nonblock, #is_ip?

Constructor Details

This class inherits a constructor from ReDNS::Fragment

Instance Method Details

#deserialize(buffer) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/redns/record/null.rb', line 26

def deserialize(buffer)
  self.contents = ''
  
  while (!buffer.empty?)
 	  if (content_length = buffer.unpack('C')[0])
 	    if (string = buffer.unpack("a#{content_length}")[0])
     	  self.contents << string
   	  end
 	  end
  end

  self
end

#serialize(buffer = ReDNS::Buffer.new) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/redns/record/null.rb', line 18

def serialize(buffer = ReDNS::Buffer.new)
  buffer.pack('C', self.contents.length)

  buffer.append(self.contents)

  buffer
end

#to_aObject



14
15
16
# File 'lib/redns/record/null.rb', line 14

def to_a
	[ self.contents ]
end

#to_sObject

Instance Methods =====================================================



10
11
12
# File 'lib/redns/record/null.rb', line 10

def to_s
	"#{self.contents}"
end