Class: DJB::TinyDNS::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/djb/tinydns.rb

Overview

————————————————#

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, addr) ⇒ Location

Returns a new instance of Location.



70
71
72
73
74
# File 'lib/djb/tinydns.rb', line 70

def initialize(name, addr)
    @name, @addr = name, addr
    @resources = Array.new
    @resources << "%#{@name}:#{@addr}"
end

Instance Attribute Details

#addrObject (readonly)

Returns the value of attribute addr.



69
70
71
# File 'lib/djb/tinydns.rb', line 69

def addr
  @addr
end

#nameObject (readonly)

Returns the value of attribute name.



69
70
71
# File 'lib/djb/tinydns.rb', line 69

def name
  @name
end

Instance Method Details

#add(res) ⇒ Object Also known as: <<



76
77
78
# File 'lib/djb/tinydns.rb', line 76

def add(res)
    @resources << res.to_s + ":#{@name}"
end

#to_sObject



81
82
83
# File 'lib/djb/tinydns.rb', line 81

def to_s
    return @resources.join("\n")
end