class DNS::Monitor::Check

Public Class Methods

new(domain, status, diff={}) click to toggle source

A “Check” is an encapsulated domain query result.

# File lib/dns/monitor/check.rb, line 5
def initialize(domain, status, diff={})
  @diff = diff
  @domain = domain
  @status = status
end

Public Instance Methods

changed?() click to toggle source
# File lib/dns/monitor/check.rb, line 11
def changed?
  @status == :changed
end
ok?() click to toggle source
# File lib/dns/monitor/check.rb, line 15
def ok?
  @status == :ok
end
status() click to toggle source
# File lib/dns/monitor/check.rb, line 19
def status
  case @status
    when :ok
      { domain: @domain, ok: true }
    when :changed
      { domain: @domain, changes: @diff }
    else
      :error
  end
end
to_s() click to toggle source
# File lib/dns/monitor/check.rb, line 30
def to_s
  status.inspect
end