Class: Glare::DnsRecords
- Inherits:
-
Result
- Object
- Result
- Glare::DnsRecords
- Defined in:
- lib/glare/dns_records.rb
Instance Method Summary collapse
- #count ⇒ Object
- #each ⇒ Object
-
#initialize(result) ⇒ DnsRecords
constructor
A new instance of DnsRecords.
- #records_to_create(desired_records) ⇒ Object
- #records_to_delete(targer_number) ⇒ Object
- #records_to_update(desired_records) ⇒ Object
Constructor Details
#initialize(result) ⇒ DnsRecords
Returns a new instance of DnsRecords.
13 14 15 16 |
# File 'lib/glare/dns_records.rb', line 13 def initialize(result) super(result) @records = records end |
Instance Method Details
#count ⇒ Object
24 25 26 |
# File 'lib/glare/dns_records.rb', line 24 def count @records.count end |
#each ⇒ Object
28 29 30 |
# File 'lib/glare/dns_records.rb', line 28 def each @records.each { |record| yield(record) } end |
#records_to_create(desired_records) ⇒ Object
39 40 41 |
# File 'lib/glare/dns_records.rb', line 39 def records_to_create(desired_records) desired_records.drop(count) end |
#records_to_delete(targer_number) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/glare/dns_records.rb', line 32 def records_to_delete(targer_number) records_to_delete = count - targer_number return [] if records_to_delete < 0 @records.pop(records_to_delete) end |
#records_to_update(desired_records) ⇒ Object
18 19 20 21 22 |
# File 'lib/glare/dns_records.rb', line 18 def records_to_update(desired_records) @records.reject do |record| desired_records.any? { |r| r.content == record.content } end end |