Class | Loquacious::Configuration::Help |
In: |
lib/loquacious/configuration/help.rb
|
Parent: | Object |
Generate nicely formatted help messages for a configuration. The Help class iterates over all the attributes in a configuration and outputs the name, value, and description to an IO stream. The format of the messages can be configured, and the description and/or value of the attribute can be shown or hidden independently.
Create a new Help instance for the given configuration where config can be either a Configuration instance or a configuration name or symbol. Several options can be provided to determine how the configuration information will be printed to the IO stream.
:name_leader String appearing before the attribute name :name_length Maximum length for an attribute name :name_value_sep String separating the attribute name from the value :desc_leader String appearing before the description :io The IO object where help will be written :nesting_nodes Flag to enable or disable output of nesting nodes (this does not affect display of attributes contained by the nesting nodes) :colorize Flag to colorize the output or not :colors Hash of colors for the name, value, description :name Name color :value Value color :description Description color :leader Leader and spacer color
The description is printed before each attribute name and value on its own line.
Returns true if the help instance is configured to colorize the output messages. Returns false otherwise.
Format the name of the attribute pointed at by the given node. If the show_value flag is set to true, then the attribute value will also be included in the returned string.
Format the attribute name, value, and description and print the results. The value can be printed or not by setting the show_value flag to either true or false. The description can be printed or not by setting the show_description flag to either true or false.
Show all attributes for the configuration. The same options allowed by the show method are also supported by this method.
Use this method to show the description for a single attribute or for all the attributes if no name is given. The options allow you to show the values along with the attributes and to hide the descriptions (if all you want to see are the values).
:descriptions => true to show descriptions and false to hide them :values => true to show values and false to hide them
Returns true if the help instance is configured to show nesting configuration nodes when iterating over the attributes. This only prevents the nesting node name from being displayed. The attributes nested under the node are still displayed regardless of this setting.