Module: RightConf::Configurator::ClassMethods
- Defined in:
- lib/rconf/configurator.rb
Instance Attribute Summary collapse
-
#all_settings ⇒ Object
readonly
Access to settings for documentation.
-
#desc ⇒ Object
readonly
Description.
-
#key ⇒ Object
readonly
Key associated with configurator.
-
#required_settings ⇒ Object
readonly
Access to required settings for validation.
Instance Method Summary collapse
-
#description(description) ⇒ Object
Store description for documentation.
-
#register(key) ⇒ Object
Associate configurator with given key.
-
#settings(settings) ⇒ Object
Store settings and their descriptions in a hash.
-
#validate_has_settings(*settings) ⇒ Object
Parameters settings(Array):: List of settings that should be checked.
Instance Attribute Details
#all_settings ⇒ Object (readonly)
Access to settings for documentation
30 31 32 |
# File 'lib/rconf/configurator.rb', line 30 def all_settings @all_settings end |
#desc ⇒ Object (readonly)
Description
27 28 29 |
# File 'lib/rconf/configurator.rb', line 27 def desc @desc end |
#key ⇒ Object (readonly)
Key associated with configurator
24 25 26 |
# File 'lib/rconf/configurator.rb', line 24 def key @key end |
#required_settings ⇒ Object (readonly)
Access to required settings for validation
33 34 35 |
# File 'lib/rconf/configurator.rb', line 33 def required_settings @required_settings end |
Instance Method Details
#description(description) ⇒ Object
Store description for documentation
Parameters
- description(String)
-
Description
Return
- true
-
Always return true
55 56 57 58 |
# File 'lib/rconf/configurator.rb', line 55 def description(description) @desc = description true end |
#register(key) ⇒ Object
Associate configurator with given key
Parameters
- key(Symbol)
-
Key configurator should be associated with
Return
- true
-
Always return true
42 43 44 45 46 |
# File 'lib/rconf/configurator.rb', line 42 def register(key) ConfiguratorRegistry[key] = self @key = key true end |
#settings(settings) ⇒ Object
Store settings and their descriptions in a hash
Parameters
- settings(Hash)
-
Settings descriptions indexed by names
Return
- true
-
Always return true
67 68 69 70 |
# File 'lib/rconf/configurator.rb', line 67 def settings(settings) @all_settings = settings true end |
#validate_has_settings(*settings) ⇒ Object
Parameters
- settings(Array)
-
List of settings that should be checked
Return
- true
-
Always return true
79 80 81 82 |
# File 'lib/rconf/configurator.rb', line 79 def validate_has_settings(*settings) @required_settings = settings.flatten true end |