Class: Net::DNS::RR

Inherits:
Object
  • Object
show all
Defined in:
lib/domain-probe/resolver_patch.rb

Defined Under Namespace

Classes: A, AAAA, CNAME, HINFO, MR, MX, NS, SOA, SPF, SRV, TXT, Types

Instance Method Summary collapse

Instance Method Details

#==(o) ⇒ Object Also known as: eql?



139
140
141
142
143
144
145
# File 'lib/domain-probe/resolver_patch.rb', line 139

def ==(o)
  if o.is_a? RR
    self.data == o.data
  else
    false
  end
end

#hashObject



149
150
151
# File 'lib/domain-probe/resolver_patch.rb', line 149

def hash
  self.data.hash
end

#remove_trailing_dot_if_any(domain) ⇒ Object

removing trailing dot, if there is one



43
44
45
46
# File 'lib/domain-probe/resolver_patch.rb', line 43

def remove_trailing_dot_if_any domain
   return domain.chop if domain && domain.end_with?(".")
   domain
end

#to_hash(zone) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/domain-probe/resolver_patch.rb', line 48

def to_hash zone
  cooked_value = name
  if zone
    zone << "." unless zone.end_with? "."
    if name == zone
      cooked_value = "@"
    else
      index = name.index(zone)
      cooked_value = name[0,index - 1] if index && index > 0
    end
  end
  
  {:name => cooked_value, :ttl => ttl}
end