Class: Dnsync::Zone

Inherits:
Object
  • Object
show all
Defined in:
lib/dnsync/zone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, records) ⇒ Zone

Returns a new instance of Zone.



9
10
11
12
13
14
15
16
17
18
# File 'lib/dnsync/zone.rb', line 9

def initialize(name, records)
  @name = name

  @records_by_identifier = {}
  records.each do |record|
    @records_by_identifier[record.identifier] = record
  end

  freeze
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/dnsync/zone.rb', line 7

def name
  @name
end

Instance Method Details

#[](identifier) ⇒ Object



20
21
22
# File 'lib/dnsync/zone.rb', line 20

def [](identifier)
  @records_by_identifier[identifier]
end

#record_identifiersObject



32
33
34
# File 'lib/dnsync/zone.rb', line 32

def record_identifiers
  @records_by_identifier.keys
end

#recordsObject



28
29
30
# File 'lib/dnsync/zone.rb', line 28

def records
  @records_by_identifier.values
end

#records_at(*identifiers) ⇒ Object



24
25
26
# File 'lib/dnsync/zone.rb', line 24

def records_at(*identifiers)
  @records_by_identifier.values_at(*identifiers.flatten)
end