0 purchases
Descriptive configuration files for Ruby written in Ruby.
Loquacious provides a very open configuration system written in ruby and descriptions for each configuration attribute.
The attributes and descriptions can be iterated over allowing for helpful information about those attributes to be displayed to the user.
In the simple case we have a file something like:
Loquacious.configuration_for('app') {
name 'value', :desc => "Defines the name"
foo 'bar', :desc => "FooBar"
id 42, :desc => "Ara T. Howard"
}
Which can be loaded via the standard Ruby loading mechanisms
load 'config/app.rb'
The attributes and their descriptions can be printed by using a Help object
help = Loquacious.help_for('app')
help.show :values => true # show the values for the attributes, too
Descriptions are optional, and configurations can be nested arbitrarily deep.
Loquacious.configuration_for('nested') {
desc "The outermost level"
a {
desc "One more level in"
b {
desc "Finally, a real value"
c 'value'
}
}
}
config = Loquacious.configuration_for 'nested'
p config.a.b.c #=> "value"
And as you can see, descriptions can either be given inline after the value or they can appear above the attribute and value on their own line.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.