class Proxy::Dns::Dnsmasq::Record

Public Class Methods

new(dns_ttl) click to toggle source
Calls superclass method
# File lib/smart_proxy_dns_dnsmasq/dns_dnsmasq_main.rb, line 8
def initialize(dns_ttl)
  super('localhost', dns_ttl)
end

Public Instance Methods

do_create(name, value, type) click to toggle source
# File lib/smart_proxy_dns_dnsmasq/dns_dnsmasq_main.rb, line 12
def do_create(name, value, type)
  case type
  when 'A', 'AAAA'
    add_entry(type, name, value)
  when 'PTR'
    add_entry(type, value, ptr_to_ip(name))
  when 'CNAME'
    add_cname(name, value)
  else
    raise Proxy::Dns::Error, "Can't create entries of type #{type}"
  end

  update!
end
do_remove(name, type) click to toggle source
# File lib/smart_proxy_dns_dnsmasq/dns_dnsmasq_main.rb, line 27
def do_remove(name, type)
  case type
  when 'A', 'AAAA'
    remove_entry(type, name)
  when 'PTR'
    remove_entry(type, nil, ptr_to_ip(name))
  when 'CNAME'
    remove_cname(name)
  else
    raise Proxy::Dns::Error, "Can't remove entries of type #{type}"
  end

  update!
end