Module: DevSuite::Utils::Construct::Config::Manager::ClassMethods
- Defined in:
- lib/dev_suite/utils/construct/config/manager.rb
Instance Method Summary collapse
-
#configuration ⇒ Object
Provides access to a single instance of the configuration class It dynamically uses the Configuration class in the including module’s namespace.
-
#configure ⇒ Object
Allows block-based configuration Example usage: ConfigClass.configure do |config| config.attr_name = value end.
-
#reset! ⇒ Object
Resets the configuration by reinitializing it with default values.
Instance Method Details
#configuration ⇒ Object
Provides access to a single instance of the configuration class It dynamically uses the Configuration class in the including module’s namespace
17 18 19 |
# File 'lib/dev_suite/utils/construct/config/manager.rb', line 17 def configuration @configuration ||= self::Configuration.new end |
#configure ⇒ Object
Allows block-based configuration Example usage:
ConfigClass.configure do |config|
config.attr_name = value
end
26 27 28 29 30 |
# File 'lib/dev_suite/utils/construct/config/manager.rb', line 26 def configure yield(configuration) rescue StandardError => e ErrorHandler.handle_error(e) end |
#reset! ⇒ Object
Resets the configuration by reinitializing it with default values
33 34 35 |
# File 'lib/dev_suite/utils/construct/config/manager.rb', line 33 def reset! @configuration = self::Configuration.new # Reinitialize the configuration instance end |