Module: Banter::Configuration
- Defined in:
 - lib/banter/configuration.rb
 
Constant Summary collapse
- @@conf =
 nil- @@default_queue_ttl =
 1.hour
- @@exchange_name =
 "banter"- @@topic_prefix =
 "banter"- @@logging_enabled =
 true- @@push_enabled =
 true- @@batch_messages =
 false- @@web_enabled =
 false
Class Method Summary collapse
- .application_name ⇒ Object
 - .configuration ⇒ Object
 - .configure_with(environment_name, yaml_file = nil) ⇒ Object
 - .connection ⇒ Object
 - .environment ⇒ Object
 
Class Method Details
.application_name ⇒ Object
      76 77 78 79 80 81 82  | 
    
      # File 'lib/banter/configuration.rb', line 76 def self.application_name @application_name ||= if defined?(Rails) Rails.application.class.name.to_s.gsub("::Application", '') else 'banter' end.downcase end  | 
  
.configuration ⇒ Object
      54 55 56 57  | 
    
      # File 'lib/banter/configuration.rb', line 54 def self.configuration self.configure_with(self.environment) if @@conf.nil? @@conf end  | 
  
.configure_with(environment_name, yaml_file = nil) ⇒ Object
      47 48 49 50 51 52  | 
    
      # File 'lib/banter/configuration.rb', line 47 def self.configure_with(environment_name, yaml_file = nil) @@yaml_file = yaml_file.nil? ? "config/banter.yml" : yaml_file @@all_conf = Hashie::Mash.new(YAML.load_file(@@yaml_file) ) @@conf = @@all_conf[environment_name.to_sym] self end  | 
  
.connection ⇒ Object
      59 60 61  | 
    
      # File 'lib/banter/configuration.rb', line 59 def self.connection configuration[:connection] end  | 
  
.environment ⇒ Object
      63 64 65 66 67 68 69 70 71 72 73 74  | 
    
      # File 'lib/banter/configuration.rb', line 63 def self.environment val = ENV["RAILS_ENV"] || ENV["RACK_ENV"] val = if val.present? val.to_sym else if defined?(Rails) Rails.env else raise "No environment can be found for configuration!" end end end  |