21 lines
264 B
Ruby
21 lines
264 B
Ruby
require 'yaml'
|
|
|
|
class Config
|
|
|
|
def initialize(config_path)
|
|
@data = YAML::load_file(config_path)
|
|
end
|
|
|
|
def get(key, depth = 0)
|
|
bits = key.split('.')
|
|
value = @data
|
|
|
|
bits.each do |bit|
|
|
value = value[bit]
|
|
end
|
|
|
|
return value
|
|
end
|
|
|
|
end
|