This is the data structure that stores all the keywords specifiing the job. Internaly, it uses Hash for the storage, but it should not be accessed directly. The indexes are Symbols, when the settings are read from hash or file, string indexes are converted to symbols (and lowercase).
There is a list of possible keywords stored in YAML file with adittional info on the keyword, such as type and default value.
When the Settings structure is build from a Hash (that can be read from YAML file), every keyword is checked against the keyword list. Unknown keyword raises an error, so does keyword that has apparently wrong type.
When a keyword is looked up using the [] method and the keyword is missing, action specified in the keyword database is performed. The options are:
When default value is used, it is written into the settings as well. It means each warning is printed only once, and the complete settings can be printed out at the end of the job.
The settings can have multiple levels, but only the root level is used by the actual calculations. Subsections of deeper levels can be used to store settings for different parts of the job, but must be copied to the root level before the calculation is performed.
One record used of the keywords database - there it is indexed by the keyword name.
[](*args)
Read from the settings. Allows any depth of subsections, from root level:
settings[:keyword]
deeper into the subsection tree:
settings[:subsection, :subsubsection, ..., :keyword]
Behaviour when keyword is not found is described above.
[]=(*args)
Write to the settings - syntax similar to [] . Subsections are created when do not exist.
settings[:subsection, :keyword] = value
from_hash(hash)
Constructs the Settings data stucture from Hash, converting the keys to lowercase symbols and checking the values as described above
from_yaml_file(filename)
Loads settings from YAML file (where it should be stored as a Hash) using all the fixes in from_hash
key_to_symbol(hash) #=> Hash
Builds symbol-indexed hash from string or symbol -indexed one. All keys are made lowercase.