Class: Dnsync::Zone
- Inherits:
-
Object
- Object
- Dnsync::Zone
- Defined in:
- lib/dnsync/zone.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #[](identifier) ⇒ Object
-
#initialize(name, records) ⇒ Zone
constructor
A new instance of Zone.
- #record_identifiers ⇒ Object
- #records ⇒ Object
- #records_at(*identifiers) ⇒ Object
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
#name ⇒ Object (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_identifiers ⇒ Object
32 33 34 |
# File 'lib/dnsync/zone.rb', line 32 def record_identifiers @records_by_identifier.keys end |
#records ⇒ Object
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 |