Class: Zonesync::Record
- Inherits:
-
Struct
- Object
- Struct
- Zonesync::Record
- Defined in:
- lib/zonesync/record.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rdata ⇒ Object
Returns the value of attribute rdata.
-
#ttl ⇒ Object
Returns the value of attribute ttl.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment
2 3 4 |
# File 'lib/zonesync/record.rb', line 2 def comment @comment end |
#name ⇒ Object
Returns the value of attribute name
2 3 4 |
# File 'lib/zonesync/record.rb', line 2 def name @name end |
#rdata ⇒ Object
Returns the value of attribute rdata
2 3 4 |
# File 'lib/zonesync/record.rb', line 2 def rdata @rdata end |
#ttl ⇒ Object
Returns the value of attribute ttl
2 3 4 |
# File 'lib/zonesync/record.rb', line 2 def ttl @ttl end |
#type ⇒ Object
Returns the value of attribute type
2 3 4 |
# File 'lib/zonesync/record.rb', line 2 def type @type end |
Class Method Details
.from_dns_zonefile_record(record) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/zonesync/record.rb', line 3 def self.from_dns_zonefile_record record type = record.class.name.split("::").last rdata = case type when "SOA" def record.host = origin "" # it just gets ignored anyways when "A", "AAAA" record.address when "CNAME", "NS", "PTR" record.domainname when "MX" "#{record.priority} #{record.domainname}" when "TXT", "SPF", "NAPTR" record.data else raise NotImplementedError.new(record.class).to_s end new( record.host, type, record.ttl, rdata, record.comment, ) end |
Instance Method Details
#<=>(other) ⇒ Object
30 31 32 |
# File 'lib/zonesync/record.rb', line 30 def <=> other to_sortable <=> other.to_sortable end |
#to_s ⇒ Object
38 39 40 41 42 |
# File 'lib/zonesync/record.rb', line 38 def to_s string = [name, type, ttl, rdata].join(" ") string << " ; #{comment}" if comment string end |
#to_sortable ⇒ Object
34 35 36 |
# File 'lib/zonesync/record.rb', line 34 def to_sortable [type, name, rdata, ttl] end |