class EZDyn::UpdateChange

A pending record update.

Public Class Methods

new(records:, new_records:) click to toggle source

@private

# File lib/ezdyn/changes.rb, line 70
def initialize(records:, new_records:)
  @records = records.map(&:sync!)
  @new_records = new_records
end

Public Instance Methods

to_s() click to toggle source

Returns a string representation of the change.

@return [String] A string representation of this change.

# File lib/ezdyn/changes.rb, line 82
def to_s
  ttl_string =
    if @records.map(&:ttl).min == @new_records.map(&:ttl).min
      @records.map(&:ttl).min
    else
      "(( #{@records.map(&:ttl).min} -> #{@new_records.map(&:ttl).min} ))"
    end

  value_string =
    if @records.map(&:value).join(',') == @new_records.map(&:value).join(',')
      @records.map(&:value).join(',')
    else
      "(( #{@records.map(&:value).join(',')} -> #{@new_records.map(&:value).join(',')} ))"
    end

  "UPDATE #{@new_records.first.fqdn}.   #{ttl_string} #{@new_records.first.type}   #{value_string}"
end
zone() click to toggle source
# File lib/ezdyn/changes.rb, line 75
def zone
  @new_records.first.zone
end