Sha256: 1a060ee6f88f7dbca2df5a621cff5b49086c94862adf3d97e0159978cb3c8cf0
Contents?: true
Size: 858 Bytes
Versions: 5
Compression:
Stored size: 858 Bytes
Contents
require 'yaml' module RubyApp require 'ruby_app/log' require 'ruby_app/mixins/delegate_mixin' require 'ruby_app/mixins/hash_mixin' class Configuration extend RubyApp::Mixins::DelegateMixin attr_reader :document def self.get @@_configuration end def self.load!(paths) @@_configuration = RubyApp::Configuration.new(paths) end def self.unload! @@_configuration = nil end private def initialize(paths) @document = {} paths.each do |path| File.open(path, 'r') do |file| @document.merge!(YAML::load(file)[ENV['RUBY_APP_CONFIGURATION'] || 'default'] || {}) end end @document.symbolize! RubyApp::Log.debug("#{self.class}##{__method__} @document = ...") RubyApp::Log.debug_hash(@document) end end end
Version data entries
5 entries across 5 versions & 1 rubygems