Class: Rack::Reqorder::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/reqorder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



67
68
69
70
71
72
73
74
# File 'lib/rack/reqorder.rb', line 67

def initialize
  self.auth_email = '[email protected]' if auth_email.blank?
  self.auth_password = 'password' if auth_password.blank?
  self.no_auth = false if self.no_auth.blank?
  self.metrics_monitoring = true if self.metrics_monitoring.blank?
  self.exception_monitoring = true if self.exception_monitoring.blank?
  self.request_monitoring = true if self.request_monitoring.blank?
end

Instance Attribute Details

#auth_emailObject

Returns the value of attribute auth_email.



45
46
47
# File 'lib/rack/reqorder.rb', line 45

def auth_email
  @auth_email
end

#auth_passwordObject

Returns the value of attribute auth_password.



45
46
47
# File 'lib/rack/reqorder.rb', line 45

def auth_password
  @auth_password
end

#environmentObject

Returns the value of attribute environment.



45
46
47
# File 'lib/rack/reqorder.rb', line 45

def environment
  @environment
end

#exception_monitoringObject

Returns the value of attribute exception_monitoring.



45
46
47
# File 'lib/rack/reqorder.rb', line 45

def exception_monitoring
  @exception_monitoring
end

#metrics_monitoringObject

Returns the value of attribute metrics_monitoring.



45
46
47
# File 'lib/rack/reqorder.rb', line 45

def metrics_monitoring
  @metrics_monitoring
end

#mongoid_ymlObject

Returns the value of attribute mongoid_yml.



45
46
47
# File 'lib/rack/reqorder.rb', line 45

def mongoid_yml
  @mongoid_yml
end

#no_authObject

Returns the value of attribute no_auth.



45
46
47
# File 'lib/rack/reqorder.rb', line 45

def no_auth
  @no_auth
end

#request_monitoringObject

Returns the value of attribute request_monitoring.



45
46
47
# File 'lib/rack/reqorder.rb', line 45

def request_monitoring
  @request_monitoring
end

Instance Method Details

#app_environmentObject



59
60
61
62
63
64
65
# File 'lib/rack/reqorder.rb', line 59

def app_environment
  if Module.const_defined?(:Rails)
    return Rails.env
  else
    return ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
  end
end

#validate!Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/rack/reqorder.rb', line 48

def validate!
  if mongoid_yml.blank?
    raise 'You need to setup mongoid.yml before using this gem'
  end

  if environment.blank?
    self.environment = app_environment
  end

end