Sha256: eefdb235ff12d0fb0622041f6ba842a585f618549f15c6074744ee51615992fe
Contents?: true
Size: 760 Bytes
Versions: 1
Compression:
Stored size: 760 Bytes
Contents
module RubyPitaya class Config def initialize(configs_folder_path) path_to_all_files = File.join(configs_folder_path, '**/*.json') config_files = Dir.glob(path_to_all_files) config_hashes = [] config_files.each do |config_file| config_text = File.open(config_file, &:read) config_readed = JSON.parse(config_text) path_array = config_file.sub(/^#{configs_folder_path}/, '')[0..-6] .split('/') config_hash = path_array.reverse.inject(config_readed) {|a, b| {b => a}} config_hashes << config_hash end @config = config_hashes.inject(&:deep_merge) end def get @config end def [](key) @config[key] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubypitaya-1.1.0 | ./lib/rubypitaya/core/config.rb |