Class: Zonesync::Zonefile
- Inherits:
-
Object
- Object
- Zonesync::Zonefile
- Extended by:
- T::Sig
- Defined in:
- lib/zonesync/zonefile.rb
Instance Attribute Summary collapse
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(records, origin:) ⇒ Zonefile
constructor
A new instance of Zonefile.
Constructor Details
#initialize(records, origin:) ⇒ Zonefile
Returns a new instance of Zonefile.
23 24 25 26 |
# File 'lib/zonesync/zonefile.rb', line 23 def initialize records, origin: @records = records @origin = origin end |
Instance Attribute Details
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
32 33 34 |
# File 'lib/zonesync/zonefile.rb', line 32 def origin @origin end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
29 30 31 |
# File 'lib/zonesync/zonefile.rb', line 29 def records @records end |
Class Method Details
.load(zone_string) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/zonesync/zonefile.rb', line 11 def self.load(zone_string) if zone_string !~ /\sSOA\s/ # insert dummy SOA to trick parser if needed zone_string.sub!(/\n([^$])/, "\n@ 1 SOA example.com example.com ( 2000010101 1 1 1 1 )\n\\1") end zone = Parser.parse(zone_string) records = zone.records.map do |dns_zonefile_record| Zonesync::Record.from_dns_zonefile_record(dns_zonefile_record) end new(records, origin: zone.origin) end |