lib/dns_one.rb in dns_one-0.4.13 vs lib/dns_one.rb in dns_one-0.4.14
- old
+ new
@@ -1,15 +1,15 @@
# Core
require 'syslog'
require 'syslog/logger'
+require 'ostruct'
+require 'yaml'
+require 'singleton'
# Gems
-require 'rubydns'
-require 'active_record'
-require 'yaml'
require 'rexec'
-require 'ostruct'
+require 'rubydns'
# DnsOne
require "dns_one/core_ext/exception"
require "dns_one/core_ext/string"
@@ -65,15 +65,17 @@
def start
Server.new(@conf_all.server, @conf_all.zone_search).run
end
private
-
+def symbolize_keys(hash)
+ hash.each_with_object({}) { |(k, v), h| h[k.to_sym] = v.is_a?(Hash) ? symbolize_keys(v) : v }
+end
def parse_conf conf_file
check_conf_file conf_file
conf = YAML.load_file conf_file
- conf.deep_symbolize_keys!
+ conf = symbolize_keys conf
OpenStruct.new(
main: {
work_dir: conf[:config][:work_dir],
log_file: conf[:config][:log_file]