Class: Jackhammer::Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jackhammer/configuration.rb', line 17

def initialize
  @connection_options = {}
  @connection_url = ENV['RABBITMQ_URL']
  @environment = ENV['RACK_ENV'] || :development
  @exception_adapter = proc { |e| fail e }
  @logger = Logger.new IO::NULL
  @publish_options = { mandatory: true, persistent: true }
  @yaml_config = './config/jackhammer.yml'
  @client_middleware = MiddlewareCollection.new
  @server_middleware = MiddlewareCollection.new
end

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def app_name
  @app_name
end

#client_middlewareObject

Returns the value of attribute client_middleware.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def client_middleware
  @client_middleware
end

#connection_optionsObject

Returns the value of attribute connection_options.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def connection_options
  @connection_options
end

#connection_urlObject

Returns the value of attribute connection_url.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def connection_url
  @connection_url
end

#environmentObject

Returns the value of attribute environment.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def environment
  @environment
end

#exception_adapterObject

Returns the value of attribute exception_adapter.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def exception_adapter
  @exception_adapter
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def logger
  @logger
end

#publish_optionsObject

Returns the value of attribute publish_options.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def publish_options
  @publish_options
end

#serverObject

Returns the value of attribute server.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def server
  @server
end

#server_middlewareObject

Returns the value of attribute server_middleware.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def server_middleware
  @server_middleware
end

#yaml_configObject

Returns the value of attribute yaml_config.



3
4
5
# File 'lib/jackhammer/configuration.rb', line 3

def yaml_config
  @yaml_config
end

Class Method Details

.instanceObject



29
30
31
# File 'lib/jackhammer/configuration.rb', line 29

def self.instance
  @instance ||= new
end

Instance Method Details

#yamlObject



33
34
35
36
# File 'lib/jackhammer/configuration.rb', line 33

def yaml
  environment = Jackhammer.configuration.environment.to_s
  YAML.load_file(Jackhammer.configuration.yaml_config)[environment]
end