Module: PriceHubble::ConfigurationHandling
- Extended by:
- ActiveSupport::Concern
- Included in:
- PriceHubble
- Defined in:
- lib/price_hubble/configuration_handling.rb
Overview
The top-level configuration handling.
rubocop:disable Style/ClassVars because we split module code
Class Method Summary collapse
-
.configuration ⇒ Configuration
Retrieve the current configuration object.
-
.configure {|configuration| ... } ⇒ Object
Configure the concern by providing a block which takes care of this task.
-
.identity_params ⇒ Hash{Symbol => String}
Get back the credentials bundle for an authentication.
-
.logger ⇒ Logger
Retrieve the current configured logger instance.
-
.reset_configuration! ⇒ Object
Reset the current configuration with the default one.
Class Method Details
.configuration ⇒ Configuration
Retrieve the current configuration object.
14 15 16 |
# File 'lib/price_hubble/configuration_handling.rb', line 14 def configuration @@configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
Configure the concern by providing a block which takes care of this task. Example:
FactoryBot::Instrumentation.configure do |conf|
# conf.xyz = [..]
end
24 25 26 |
# File 'lib/price_hubble/configuration_handling.rb', line 24 def configure yield(configuration) end |
.identity_params ⇒ Hash{Symbol => String}
Get back the credentials bundle for an authentication.
36 37 38 39 40 41 |
# File 'lib/price_hubble/configuration_handling.rb', line 36 def identity_params { username: configuration.username, password: configuration.password } end |
.logger ⇒ Logger
Retrieve the current configured logger instance.
46 |
# File 'lib/price_hubble/configuration_handling.rb', line 46 delegate :logger, to: :configuration |
.reset_configuration! ⇒ Object
Reset the current configuration with the default one.
29 30 31 |
# File 'lib/price_hubble/configuration_handling.rb', line 29 def reset_configuration! @@configuration = Configuration.new end |