Class: Zonesync::Record
- Inherits:
-
Struct
- Object
- Struct
- Zonesync::Record
- Extended by:
- T::Sig
- 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
- #<=>(other) ⇒ Object
- #checksum? ⇒ Boolean
- #manifest? ⇒ Boolean
- #short_name(origin) ⇒ Object
- #to_s ⇒ Object
- #to_sortable ⇒ Object
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment
5 6 7 |
# File 'lib/zonesync/record.rb', line 5 def comment @comment end |
#name ⇒ Object
Returns the value of attribute name
5 6 7 |
# File 'lib/zonesync/record.rb', line 5 def name @name end |
#rdata ⇒ Object
Returns the value of attribute rdata
5 6 7 |
# File 'lib/zonesync/record.rb', line 5 def rdata @rdata end |
#ttl ⇒ Object
Returns the value of attribute ttl
5 6 7 |
# File 'lib/zonesync/record.rb', line 5 def ttl @ttl end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/zonesync/record.rb', line 5 def type @type end |
Class Method Details
.from_dns_zonefile_record(record) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/zonesync/record.rb', line 9 def self.from_dns_zonefile_record record new( name: record.host, type: record.type, ttl: record.ttl, rdata: record.rdata, comment: record.comment, ) end |
Instance Method Details
#<=>(other) ⇒ Object
40 41 42 |
# File 'lib/zonesync/record.rb', line 40 def <=> other to_sortable <=> other.to_sortable end |
#checksum? ⇒ Boolean
34 35 36 37 |
# File 'lib/zonesync/record.rb', line 34 def checksum? type == "TXT" && name.match?(/^zonesync_checksum\./) end |
#manifest? ⇒ Boolean
28 29 30 31 |
# File 'lib/zonesync/record.rb', line 28 def manifest? type == "TXT" && name.match?(/^zonesync_manifest\./) end |
#short_name(origin) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/zonesync/record.rb', line 20 def short_name origin ret = name.sub(origin, "") ret = ret.sub(/\.$/, "") ret = "@" if ret == "" ret end |
#to_s ⇒ Object
51 52 53 54 55 |
# File 'lib/zonesync/record.rb', line 51 def to_s string = [name, ttl, type, rdata].join(" ") string << " ; #{comment}" if comment string end |
#to_sortable ⇒ Object
45 46 47 48 |
# File 'lib/zonesync/record.rb', line 45 def to_sortable is_soa = type == "SOA" ? 0 : 1 [is_soa, type, name, rdata, ttl.to_i] end |