Class: DJB::TinyDNS::Location
- Inherits:
-
Object
- Object
- DJB::TinyDNS::Location
- Defined in:
- lib/djb/tinydns.rb
Overview
————————————————#
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add(res) ⇒ Object (also: #<<)
-
#initialize(name, addr) ⇒ Location
constructor
A new instance of Location.
- #to_s ⇒ Object
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
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
69 70 71 |
# File 'lib/djb/tinydns.rb', line 69 def addr @addr end |
#name ⇒ Object (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_s ⇒ Object
81 82 83 |
# File 'lib/djb/tinydns.rb', line 81 def to_s return @resources.join("\n") end |