Module: ComplexConfig::Provider::Shortcuts
- Included in:
- ComplexConfig::Provider, Object
- Defined in:
- lib/complex_config/provider/shortcuts.rb
Overview
A module that provides convenient shortcuts for accessing configuration data
This module defines methods that create proxy objects for easy configuration access with lazy evaluation and environment-specific lookups. It’s designed to be included in classes that need quick access to configuration settings without explicit environment handling.
Instance Method Summary collapse
-
#complex_config(name = nil) ⇒ ComplexConfig::Settings, ComplexConfig::Proxy
The complex_config method provides access to configuration data with optional name parameter.
-
#complex_config_with_env(name = nil, env = ComplexConfig::Provider.env) ⇒ ComplexConfig::Settings, ComplexConfig::Proxy
(also: #cc)
The complex_config_with_env method provides access to configuration data with explicit environment targeting.
Instance Method Details
#complex_config(name = nil) ⇒ ComplexConfig::Settings, ComplexConfig::Proxy
The complex_config method provides access to configuration data with optional name parameter.
to return a proxy object the configuration settings for the specified name, or a proxy object if no name is provided
47 48 49 50 51 52 53 |
# File 'lib/complex_config/provider/shortcuts.rb', line 47 def complex_config(name = nil) if name ComplexConfig::Provider[name] else ComplexConfig::Provider.proxy end end |
#complex_config_with_env(name = nil, env = ComplexConfig::Provider.env) ⇒ ComplexConfig::Settings, ComplexConfig::Proxy Also known as: cc
The complex_config_with_env method provides access to configuration data with explicit environment targeting.
to return a proxy object
lookups, defaults to the current provider environment
the configuration settings for the specified name and environment, or a proxy object if no name is provided
24 25 26 27 28 29 30 |
# File 'lib/complex_config/provider/shortcuts.rb', line 24 def complex_config_with_env(name = nil, env = ComplexConfig::Provider.env) if name ComplexConfig::Provider[name][env.to_s] else ComplexConfig::Provider.proxy(env.to_s) end end |