Class: Errorkit::Config
- Inherits:
-
Object
- Object
- Errorkit::Config
- Defined in:
- lib/errorkit/config.rb
Instance Attribute Summary collapse
-
#alert_threshold ⇒ Object
Returns the value of attribute alert_threshold.
-
#errors_class ⇒ Object
Returns the value of attribute errors_class.
-
#errors_controller ⇒ Object
Returns the value of attribute errors_controller.
-
#errors_layout ⇒ Object
Returns the value of attribute errors_layout.
-
#errors_mailer ⇒ Object
Returns the value of attribute errors_mailer.
-
#format_errors ⇒ Object
Returns the value of attribute format_errors.
-
#ignore_agents ⇒ Object
Returns the value of attribute ignore_agents.
-
#ignore_exceptions ⇒ Object
Returns the value of attribute ignore_exceptions.
-
#mailer_recipients ⇒ Object
Returns the value of attribute mailer_recipients.
-
#mailer_sender ⇒ Object
Returns the value of attribute mailer_sender.
-
#max_notifications_per_minute ⇒ Object
Returns the value of attribute max_notifications_per_minute.
-
#max_notifications_per_quarter_hour ⇒ Object
Returns the value of attribute max_notifications_per_quarter_hour.
Instance Method Summary collapse
- #config ⇒ Object
- #ignore_agent?(agent) ⇒ Boolean
- #ignore_exception?(exception) ⇒ Boolean
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/errorkit/config.rb', line 18 def initialize @errors_mailer = Errorkit::ErrorsMailer @errors_layout = false @ignore_exceptions = [] @ignore_exceptions << ::ActiveRecord::RecordNotFound if defined? ::ActiveRecord::RecordNotFound @ignore_exceptions << ::AbstractController::ActionNotFound if defined? ::AbstractController::ActionNotFound @ignore_exceptions << ::ActionController::RoutingError if defined? ::ActionController::RoutingError @ignore_agents = %w{Googlebot MSNBot Baiduspider Bing Inktomi Yahoo AskJeeves FastCrawler InfoSeek Lycos YandexBot NewRelicPinger Pingdom} @max_notifications_per_minute = 5 @max_notifications_per_quarter_hour = 10 @format_errors = true @alert_threshold = 0.4 end |
Instance Attribute Details
#alert_threshold ⇒ Object
Returns the value of attribute alert_threshold.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def alert_threshold @alert_threshold end |
#errors_class ⇒ Object
Returns the value of attribute errors_class.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def errors_class @errors_class end |
#errors_controller ⇒ Object
Returns the value of attribute errors_controller.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def errors_controller @errors_controller end |
#errors_layout ⇒ Object
Returns the value of attribute errors_layout.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def errors_layout @errors_layout end |
#errors_mailer ⇒ Object
Returns the value of attribute errors_mailer.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def errors_mailer @errors_mailer end |
#format_errors ⇒ Object
Returns the value of attribute format_errors.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def format_errors @format_errors end |
#ignore_agents ⇒ Object
Returns the value of attribute ignore_agents.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def ignore_agents @ignore_agents end |
#ignore_exceptions ⇒ Object
Returns the value of attribute ignore_exceptions.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def ignore_exceptions @ignore_exceptions end |
#mailer_recipients ⇒ Object
Returns the value of attribute mailer_recipients.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def mailer_recipients @mailer_recipients end |
#mailer_sender ⇒ Object
Returns the value of attribute mailer_sender.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def mailer_sender @mailer_sender end |
#max_notifications_per_minute ⇒ Object
Returns the value of attribute max_notifications_per_minute.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def max_notifications_per_minute @max_notifications_per_minute end |
#max_notifications_per_quarter_hour ⇒ Object
Returns the value of attribute max_notifications_per_quarter_hour.
3 4 5 |
# File 'lib/errorkit/config.rb', line 3 def max_notifications_per_quarter_hour @max_notifications_per_quarter_hour end |
Instance Method Details
#config ⇒ Object
32 33 34 |
# File 'lib/errorkit/config.rb', line 32 def config self end |
#ignore_agent?(agent) ⇒ Boolean
41 42 43 44 45 |
# File 'lib/errorkit/config.rb', line 41 def ignore_agent?(agent) return false if @ignore_agents.nil? || @ignore_agents.length == 0 @ignore_agent_re ||= /(#{@ignore_agents.join('|')})/i !!(agent =~ @ignore_agents_re) end |
#ignore_exception?(exception) ⇒ Boolean
36 37 38 39 |
# File 'lib/errorkit/config.rb', line 36 def ignore_exception?(exception) return false if @ignore_exceptions.nil? || @ignore_exceptions.length == 0 @ignore_exceptions.include?(exception.class) end |