Config
The Scar::Config
module provides an easy way of storing key-value configuration. It uses Util to save and load the config file.
To use it, you have to declare your configuration structure. To do that, you can use the Scar::Config#define_standards
macro at toplevel. Just provide a hash with names and default values for every config entry. The values have to be of any type in the YAML::Any
union.
There are methods for all sorts of config manipulation. You can..
reset(key)
any value by key to its standardload_standards
to reset all values[](key)
to access a value by key (returns the default value if it is not present)[]=(key, value)
to set a valuesave(fname)
to save the current configuration to a file (via Util#write_file)load(fname)
to load a configuration from a file (via Util#read_file)dump
the yaml representation of the current configuration for debugging.
Last updated