Class: Basquiat::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/basquiat/support/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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, message|
    logger.error do
      { exception: exception, stack_trace: exception.stack_trace, message: message }.to_json
    end
    raise exception
  end
end

Instance Attribute Details

#environmentSymbol

Return the set environment or the value of the ‘BASQUIAT_ENV’ environment variable or :development

Returns:

  • (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_nameString

Returns the exchange name. Defaults to ‘basquiat.exchange’.

Returns:

  • (String)

    the exchange name. Defaults to ‘basquiat.exchange’



33
# File 'lib/basquiat/support/configuration.rb', line 33

attr_writer :queue_name, :exchange_name, :logger, :environment

#loggerLogger

Return the application logger. Defaults to DefaultLogger.

Returns:

  • (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_nameString

Returns the queue name. Defaults to ‘basquiat.queue’.

Returns:

  • (String)

    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

Returns:

  • (#call)

    return the callable to be executed when some exception is thrown. The callable receives the exception and message



38
39
40
# File 'lib/basquiat/support/configuration.rb', line 38

def rescue_proc
  @rescue_proc
end

Instance Method Details

#adapter_optionsHash

Return the configured adapter options. Defaults to an empty Hash

Returns:

  • (Hash)

    return the configured adapter options. Defaults to an empty Hash



64
65
66
# File 'lib/basquiat/support/configuration.rb', line 64

def adapter_options
  config.fetch(:adapter_options) { {} }
end

#config_file=(path) ⇒ Object

Loads a YAML file with the configuration options

Parameters:

  • path (String)

    the path of the configuration file



58
59
60
61
# File 'lib/basquiat/support/configuration.rb', line 58

def config_file=(path)
  load_yaml(path)
  setup_basic_options
end

#default_adapterString

Return the configured default adapter. Defaults to Adapters::Test

Returns:

  • (String)

    return the configured default adapter. Defaults to Adapters::Test



69
70
71
# File 'lib/basquiat/support/configuration.rb', line 69

def default_adapter
  config.fetch(:default_adapter) { 'Basquiat::Adapters::Test' }
end

#reload_classesObject

Used by the railtie. Forces the reconfiguration of all extended classes



74
75
76
# File 'lib/basquiat/support/configuration.rb', line 74

def reload_classes
  Basquiat::Base.reconfigure_children
end