Class: Basquiat::Configuration
- Inherits:
-
Object
- Object
- Basquiat::Configuration
- Defined in:
- lib/basquiat/support/configuration.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#connection - Makes Basquiat to use a provided connection(-MakesBasquiattouseaprovidedconnection) ⇒ Object
The provided connection.
-
#environment ⇒ Symbol
Return the set environment or the value of the ‘BASQUIAT_ENV’ environment variable or :development.
-
#exchange_name ⇒ String
The exchange name.
-
#logger ⇒ Logger
Return the application logger.
-
#queue_name ⇒ String
The queue name.
-
#rescue_proc ⇒ #call
Return the callable to be executed when some exception is thrown.
Instance Method Summary collapse
-
#adapter_options ⇒ Hash
Return the configured adapter options.
-
#config_file=(path) ⇒ Object
Loads a YAML file with the configuration options.
-
#default_adapter ⇒ String
Return the configured default adapter.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reload_classes ⇒ Object
Used by the railtie.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 21 22 |
# File 'lib/basquiat/support/configuration.rb', line 14 def initialize @yaml = {} @rescue_proc = lambda do |exception, | logger.error do { exception: exception, backtrace: exception.backtrace, message: }.to_json end raise exception end end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
40 41 42 |
# File 'lib/basquiat/support/configuration.rb', line 40 def connection @connection end |
#connection - Makes Basquiat to use a provided connection(-MakesBasquiattouseaprovidedconnection) ⇒ Object
Returns the provided connection.
40 |
# File 'lib/basquiat/support/configuration.rb', line 40 attr_accessor :connection, :rescue_proc |
#environment ⇒ Symbol
Return the set environment or the value of the ‘BASQUIAT_ENV’ environment variable or :development
33 |
# File 'lib/basquiat/support/configuration.rb', line 33 attr_writer :queue_name, :exchange_name, :logger, :environment |
#exchange_name ⇒ String
Returns the exchange name. Defaults to ‘basquiat.exchange’.
33 |
# File 'lib/basquiat/support/configuration.rb', line 33 attr_writer :queue_name, :exchange_name, :logger, :environment |
#logger ⇒ Logger
Return the application logger. Defaults to DefaultLogger.
33 |
# File 'lib/basquiat/support/configuration.rb', line 33 attr_writer :queue_name, :exchange_name, :logger, :environment |
#queue_name ⇒ String
Returns the queue name. Defaults to ‘basquiat.queue’.
33 |
# File 'lib/basquiat/support/configuration.rb', line 33 attr_writer :queue_name, :exchange_name, :logger, :environment |
#rescue_proc ⇒ #call
Return the callable to be executed when some exception is thrown. The callable receives the exception and message
40 |
# File 'lib/basquiat/support/configuration.rb', line 40 attr_accessor :connection, :rescue_proc |
Instance Method Details
#adapter_options ⇒ Hash
Return the configured adapter options. Defaults to an empty Hash
66 67 68 |
# File 'lib/basquiat/support/configuration.rb', line 66 def config.fetch(:adapter_options) { {} } end |
#config_file=(path) ⇒ Object
Loads a YAML file with the configuration options
60 61 62 63 |
# File 'lib/basquiat/support/configuration.rb', line 60 def config_file=(path) load_yaml(path) end |
#default_adapter ⇒ String
Return the configured default adapter. Defaults to Adapters::Test
71 72 73 |
# File 'lib/basquiat/support/configuration.rb', line 71 def default_adapter config.fetch(:default_adapter) { 'Basquiat::Adapters::Test' } end |
#reload_classes ⇒ Object
Used by the railtie. Forces the reconfiguration of all extended classes
76 77 78 |
# File 'lib/basquiat/support/configuration.rb', line 76 def reload_classes Basquiat::Base.reconfigure_children end |