Class: Superbolt::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/superbolt/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



6
7
8
# File 'lib/superbolt/config.rb', line 6

def initialize(options={})
  @options = options
end

Instance Attribute Details

#app_nameObject



10
11
12
# File 'lib/superbolt/config.rb', line 10

def app_name
  @app_name ||= options[:app_name]
end

#envObject



14
15
16
# File 'lib/superbolt/config.rb', line 14

def env
  @env ||= options[:env]
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/superbolt/config.rb', line 3

def options
  @options
end

Instance Method Details

#==(other) ⇒ Object



42
43
44
45
# File 'lib/superbolt/config.rb', line 42

def ==(other)
  other.connection_params == connection_params &&
    other.env_connection_key == env_connection_key
end

#connection_paramsObject



18
19
20
# File 'lib/superbolt/config.rb', line 18

def connection_params
  env_params || default
end

#defaultObject



38
39
40
# File 'lib/superbolt/config.rb', line 38

def default
  options[:connection_params] || {host: '127.0.0.1'}
end

#env_connection_keyObject



22
23
24
# File 'lib/superbolt/config.rb', line 22

def env_connection_key
  options[:connection_key] || 'RABBITMQ_URL'
end

#env_paramsObject



34
35
36
# File 'lib/superbolt/config.rb', line 34

def env_params
  ENV[env_connection_key]
end

#error_notifierObject



30
31
32
# File 'lib/superbolt/config.rb', line 30

def error_notifier
  options[:error_notifier]
end

#runnerObject



26
27
28
# File 'lib/superbolt/config.rb', line 26

def runner
  options[:runner]
end