Class: Net::DNS::Record

Inherits:
Record
  • Object
show all
Defined in:
lib/net/dns.rb

Direct Known Subclasses

ARecord, PTRRecord

Constant Summary

Constants included from Validations

Validations::IP_REGEXP, Validations::MAC_REGEXP

Instance Attribute Summary collapse

Attributes inherited from Record

#hostname, #logger, #proxy

Instance Method Summary collapse

Methods inherited from Record

#==, #conflicting?, #inspect, #reload!

Methods included from Validations

normalize_ip, normalize_mac, #validate_ip, #validate_mac, #validate_network

Constructor Details

#initialize(opts = { }) ⇒ Record


42
43
44
45
46
# File 'lib/net/dns.rb', line 42

def initialize opts={ }
  super(opts)
  self.ip = validate_ip self.ip
  self.resolver ||= Resolv::DNS.new
end

Instance Attribute Details

#ipObject

Returns the value of attribute ip


40
41
42
# File 'lib/net/dns.rb', line 40

def ip
  @ip
end

#resolverObject

Returns the value of attribute resolver


40
41
42
# File 'lib/net/dns.rb', line 40

def resolver
  @resolver
end

#typeObject

Returns the value of attribute type


40
41
42
# File 'lib/net/dns.rb', line 40

def type
  @type
end

Instance Method Details

#attrsObject


56
57
58
# File 'lib/net/dns.rb', line 56

def attrs
  raise "Abstract class"
end

#createObject


52
53
54
# File 'lib/net/dns.rb', line 52

def create
  logger.info "Add DNS #{type} record for #{to_s}"
end

#destroyObject


48
49
50
# File 'lib/net/dns.rb', line 48

def destroy
  logger.info "Delete the DNS #{type} record for #{to_s}"
end

#dns_lookup(ip_or_name) ⇒ Object


60
61
62
# File 'lib/net/dns.rb', line 60

def dns_lookup ip_or_name
  DNS.lookup(ip_or_name, proxy, resolver)
end