Module: WatCatcher::CatcherOfWats
- Extended by:
- ActiveSupport::Concern
- Included in:
- BugsnagController, WatsController
- Defined in:
- app/controllers/wat_catcher/catcher_of_wats.rb
Instance Method Summary collapse
Instance Method Details
#catch_wats(&block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/wat_catcher/catcher_of_wats.rb', line 25 def catch_wats(&block) block.call rescue Exception => e user = nil begin user = wat_user rescue;end request.env["wat_report"] = { request: request, user: user } raise end |
#disable_wat_report ⇒ Object
17 18 19 |
# File 'app/controllers/wat_catcher/catcher_of_wats.rb', line 17 def disable_wat_report request.env["wat_report_disabled"] = true end |
#report_wat? ⇒ Boolean
21 22 23 |
# File 'app/controllers/wat_catcher/catcher_of_wats.rb', line 21 def report_wat? !!(request.env["wat_report"].present? && !request.env["wat_report_disabled"]) end |
#wat_user ⇒ Object
13 14 15 |
# File 'app/controllers/wat_catcher/catcher_of_wats.rb', line 13 def wat_user current_user end |