Class: I18n::Airbrake::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n-airbrake/handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(exception, locale, key, options) ⇒ Handler

Returns a new instance of Handler.



5
6
7
# File 'lib/i18n-airbrake/handler.rb', line 5

def initialize(exception, locale, key, options)
  @exception, @locale, @key, @options = exception, locale, key, options
end

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
# File 'lib/i18n-airbrake/handler.rb', line 9

def call
  if Rails.env.development? or Rails.env.test?
    fail exception
  else
    notify
    @key.to_s.titleize
  end
end

#exceptionObject



18
19
20
21
22
23
24
# File 'lib/i18n-airbrake/handler.rb', line 18

def exception
  if @exception.respond_to?(:to_exception)
    @exception.to_exception
  else
    @exception
  end
end

#notifyObject



26
27
28
# File 'lib/i18n-airbrake/handler.rb', line 26

def notify
  ::Airbrake.notify exception
end