Sha256: 79f88808c7b4f1defece7bc5c55d244dc120f35a74ff761c1b238580216d2d9c
Contents?: true
Size: 1.16 KB
Versions: 7
Compression:
Stored size: 1.16 KB
Contents
module Bugsnag::Rails module ControllerMethods def self.included(base) base.extend ClassMethods end module ClassMethods private def before_bugsnag_notify(*methods, &block) _add_bugsnag_notify_callback(:before_callbacks, *methods, &block) end def _add_bugsnag_notify_callback(callback_key, *methods, &block) options = methods.last.is_a?(Hash) ? methods.pop : {} action = lambda do |controller| request_data = Bugsnag.configuration.request_data request_data[callback_key] ||= [] # Set up "method symbol" callbacks methods.each do |method_symbol| request_data[callback_key] << lambda { |notification| controller.send(method_symbol, notification) } end # Set up "block" callbacks request_data[callback_key] << lambda { |notification| controller.instance_exec(notification, &block) } if block_given? end if respond_to?(:before_action) before_action(options, &action) else before_filter(options, &action) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems