Class: SprinkleDNS::CLI::PropagatedChangeRequestPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/sprinkle_dns/cli/propagated_change_request_printer.rb

Instance Method Summary collapse

Constructor Details

#initializePropagatedChangeRequestPrinter

Returns a new instance of PropagatedChangeRequestPrinter.



3
4
5
# File 'lib/sprinkle_dns/cli/propagated_change_request_printer.rb', line 3

def initialize
  reset!
end

Instance Method Details

#draw(change_requests, sync_word = "SYNCING", synced_word = "SYNCED") ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sprinkle_dns/cli/propagated_change_request_printer.rb', line 12

def draw(change_requests, sync_word = "SYNCING", synced_word = "SYNCED")
  change_requests.each do |change_request|
    if change_request.in_sync
      hosted_zone_name = change_request.hosted_zone.name

      unless @completed.include?(hosted_zone_name)
        @completed << hosted_zone_name + '.' * change_request.tries
      end
    end
  end

  @completed.each do |complete|
    unless @printed.include?(complete)
      puts "#{complete}.. #{synced_word}!"
      @printed << complete
    end
  end

  sleep(2)
end

#reset!Object



7
8
9
10
# File 'lib/sprinkle_dns/cli/propagated_change_request_printer.rb', line 7

def reset!
  @completed = []
  @printed = []
end