lib/bullet.rb in bullet-4.14.4 vs lib/bullet.rb in bullet-4.14.5
- old
+ new
@@ -27,11 +27,11 @@
class << self
attr_writer :enable, :n_plus_one_query_enable, :unused_eager_loading_enable, :counter_cache_enable, :stacktrace_includes
attr_reader :notification_collector, :whitelist
attr_accessor :add_footer, :orm_pathches_applied
- delegate :alert=, :console=, :growl=, :rails_logger=, :xmpp=, :airbrake=, :bugsnag=, :to => UniformNotifier
+ delegate *UniformNotifier::AVAILABLE_NOTIFIERS.map { |notifier| "#{notifier}=" }, :to => UniformNotifier
def raise=(should_raise)
UniformNotifier.raise=(should_raise ? Notification::UnoptimizedQueryError : false)
end
@@ -158,11 +158,11 @@
end
end
def footer_info
info = []
- for_each_active_notifier_with_notification do |notification|
+ notification_collector.collection.each do |notification|
info << notification.short_notice
end
info
end
@@ -174,17 +174,20 @@
warnings
end
end
def profile
- Bullet.start_request if Bullet.enable?
+ if Bullet.enable?
+ begin
+ Bullet.start_request
- yield
+ yield
- if Bullet.enable? && Bullet.notification?
- Bullet.perform_out_of_channel_notifications
+ Bullet.perform_out_of_channel_notifications if Bullet.notification?
+ ensure
+ Bullet.end_request
+ end
end
- Bullet.end_request if Bullet.enable?
end
private
def for_each_active_notifier_with_notification
UniformNotifier.active_notifiers.each do |notifier|