Class: ReDNS::Address
Instance Attribute Summary
Attributes inherited from Fragment
#attributes
Instance Method Summary
collapse
Methods inherited from Fragment
attribute
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
#initialize(contents = nil) ⇒ Address
Instance Methods =====================================================
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/redns/address.rb', line 10
def initialize(contents = nil)
case (contents)
when ReDNS::Buffer
super(contents)
when String
super(:address => contents)
else
super(contents)
end
end
|
Instance Method Details
#deserialize(buffer) ⇒ Object
40
41
42
43
|
# File 'lib/redns/address.rb', line 40
def deserialize(buffer)
self.address = inet_ntoa(buffer)
self
end
|
#empty? ⇒ Boolean
23
24
25
|
# File 'lib/redns/address.rb', line 23
def empty?
self.address == '0.0.0.0'
end
|
#serialize(buffer = ReDNS::Buffer.new) ⇒ Object
35
36
37
38
|
# File 'lib/redns/address.rb', line 35
def serialize(buffer = ReDNS::Buffer.new)
buffer.append(inet_aton(self.address))
buffer
end
|
#to_a ⇒ Object
31
32
33
|
# File 'lib/redns/address.rb', line 31
def to_a
[ to_s ]
end
|
#to_s ⇒ Object
27
28
29
|
# File 'lib/redns/address.rb', line 27
def to_s
self.address
end
|