ZDNS is programmable DNS server and client.
$ git clone https://github.com/yoshida-eth0/zdns.git
$ cd zdns
$ sudo ruby bin/zdnsserver start
$ sudo ruby bin/zdnsmanager start
$ dig @127.0.0.1 example.com
You can access http://127.0.0.1:9053 by a browser.
https://github.com/yoshida-eth0/zdns/tree/master/example
https://rubygems.org/gems/daemon-spawn
https://rubygems.org/gems/activerecord
https://rubygems.org/gems/webrick-route_servlet