From 32de91327f652cc8728d82275ffff978642bdc93 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Mon, 2 Jan 2012 15:13:18 +0100 Subject: [PATCH] Fixed missing default configuration problem --- stoptime.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stoptime.rb b/stoptime.rb index ac65f29..ec8ee5d 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -94,6 +94,7 @@ module StopTime::Models # can be found. class Config + # There should only be a single configuration object (for reloading). include Singleton # The default configuation file. (FIXME: shouldn't be hardcoded!) @@ -112,6 +113,7 @@ module StopTime::Models # Loads the configuration by reaiding the file file, parsing it, and # performing a merge with descendants. def load + @config = DefaultConfig.dup cfg = nil # Read and parse the configuration. begin @@ -122,7 +124,7 @@ module StopTime::Models # Merge the loaded config with the default config (if it's a Hash) case cfg when Hash - @config = DefaultConfig.dup.merge cfg if cfg + @config.merge! cfg if cfg when nil, false # It's ok, it is empty. else