Sha256: 8cd7acaa799d3294eb97686ae5142a01d6933222e976e17c1f6d6da096229cfe
Contents?: true
Size: 980 Bytes
Versions: 1
Compression:
Stored size: 980 Bytes
Contents
module Zonesync class Record < Struct.new(:name, :type, :ttl, :rdata, :comment) 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 def <=> other to_sortable <=> other.to_sortable end def to_sortable [type, name, rdata, ttl] end def to_s string = [name, type, ttl, rdata].join(" ") string << " ; #{comment}" if comment string end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zonesync-0.7.0 | lib/zonesync/record.rb |