Exception: Zonesync::ConflictError
- Inherits:
-
StandardError
- Object
- StandardError
- Zonesync::ConflictError
- Extended by:
- T::Sig
- Defined in:
- lib/zonesync/errors.rb
Instance Method Summary collapse
-
#initialize(conflicts) ⇒ ConflictError
constructor
A new instance of ConflictError.
- #message ⇒ Object
Constructor Details
#initialize(conflicts) ⇒ ConflictError
37 38 39 |
# File 'lib/zonesync/errors.rb', line 37 def initialize(conflicts) @conflicts = conflicts end |
Instance Method Details
#message ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/zonesync/errors.rb', line 42 def conflicts_text = @conflicts.sort_by { |_existing, new_rec| new_rec.name }.map do |existing_rec, new_rec| " existing: #{existing_rec}\n new: #{new_rec}" end.join("\n\n") count = @conflicts.length record_word = count == 1 ? "record" : "records" exists_word = count == 1 ? "exists" : "exist" " The following untracked DNS \#{record_word} already \#{exists_word} and would be overwritten:\n \#{conflicts_text}\n MSG\nend\n".chomp |