Fixed missing default configuration problem

This commit is contained in:
Paul van Tilburg 2012-01-02 15:13:18 +01:00
parent 4d2e2bb217
commit 32de91327f
1 changed files with 3 additions and 1 deletions

View File

@ -94,6 +94,7 @@ module StopTime::Models
# can be found. # can be found.
class Config class Config
# There should only be a single configuration object (for reloading).
include Singleton include Singleton
# The default configuation file. (FIXME: shouldn't be hardcoded!) # 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 # Loads the configuration by reaiding the file file, parsing it, and
# performing a merge with descendants. # performing a merge with descendants.
def load def load
@config = DefaultConfig.dup
cfg = nil cfg = nil
# Read and parse the configuration. # Read and parse the configuration.
begin begin
@ -122,7 +124,7 @@ module StopTime::Models
# Merge the loaded config with the default config (if it's a Hash) # Merge the loaded config with the default config (if it's a Hash)
case cfg case cfg
when Hash when Hash
@config = DefaultConfig.dup.merge cfg if cfg @config.merge! cfg if cfg
when nil, false when nil, false
# It's ok, it is empty. # It's ok, it is empty.
else else