Yaml_config is a project mainly written in Ruby, it's free.
Simple wrapper for yaml-based config files
== Description
Simple wrapper for YAML config files.
== Simple example
require 'yaml_config'
config = YamlConfig.new(File.join(Rails.root, "config/app_config.yml"), :root => RAILS_ENV) config.get(:app_host)[:name] # -> "google.com" config.get(:app_host)[:port] # -> 80 config.get(:app_host)[:some] # -> NullProperty
== Different initializations
filename = File.join(Rails.root, "config/app_config.yml") config = YamlConfig.new(filename, :root => RAILS_ENV)
File.open(filename, "r") do |file| config = YamlConfig.new(file, :root => RAILS_ENV) end
config = YamlConfig.new(File.read(filename), :root => RAILS_ENV)
== Singleton version
In many cases (rails application is the best example) developer needs only one file for whole project. To accomplish this it possible to use singleton version of YamlConfig.
require "yaml_config" ... filename = File.join(Rails.root, "config/app_config.yml") config = AppYamlConfig.instance.init!(filename, :root => RAILS_ENV) ...
config.get(:username)
== Known issues