Sha256: 97059ce3b37d0ff93908d9f01ecd15a9a8965c9c367b13770a12ac562e895a05
Contents?: true
Size: 643 Bytes
Versions: 41
Compression:
Stored size: 643 Bytes
Contents
module ComplexConfig Config = Struct.new('Config', :config_dir, :env, :deep_freeze, :plugins) do def initialize(*) super self.plugins = [] end def configure(provider) each_pair do |name, value| value.nil? and next name == :plugins and next provider.__send__("#{name}=", value) end plugins.each do |code| provider.add_plugin(code) end self end def add_plugin(code) plugins << code self end end def self.configure config = Config.new yield config ComplexConfig::Provider.configure_with config config end end
Version data entries
41 entries across 41 versions & 1 rubygems