Added Sequel ORM for database handling; added navbar
This commit is contained in:
26
src/config.rb
Normal file
26
src/config.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
require 'yaml'
|
||||
|
||||
class Config
|
||||
|
||||
DEFAULT_CONFIG = 'config/defaults.yaml'
|
||||
|
||||
def initialize(config_path)
|
||||
@data = YAML::load_file(DEFAULT_CONFIG)
|
||||
|
||||
if File.exists?(config_path)
|
||||
@data.merge!(YAML::load_file(config_path))
|
||||
end
|
||||
end
|
||||
|
||||
def get(key, depth = 0)
|
||||
bits = key.split('.')
|
||||
value = @data
|
||||
|
||||
bits.each do |bit|
|
||||
value = value[bit]
|
||||
end
|
||||
|
||||
return value
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user