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
28 29 30 |
# File 'lib/rconf/configurator.rb', line 28 def all_settings @all_settings end |
#desc ⇒ Object (readonly)
Description
25 26 27 |
# File 'lib/rconf/configurator.rb', line 25 def desc @desc end |
#key ⇒ Object (readonly)
Key associated with configurator
22 23 24 |
# File 'lib/rconf/configurator.rb', line 22 def key @key end |
#required_settings ⇒ Object (readonly)
Access to required settings for validation
31 32 33 |
# File 'lib/rconf/configurator.rb', line 31 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
53 54 55 56 |
# File 'lib/rconf/configurator.rb', line 53 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
40 41 42 43 44 |
# File 'lib/rconf/configurator.rb', line 40 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
65 66 67 68 |
# File 'lib/rconf/configurator.rb', line 65 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
77 78 79 80 |
# File 'lib/rconf/configurator.rb', line 77 def validate_has_settings(*settings) @required_settings = settings.flatten true end |