lib/datadog/notifications.rb in datadog-notifications-0.5.0 vs lib/datadog/notifications.rb in datadog-notifications-0.5.1
- old
+ new
@@ -29,11 +29,11 @@
# * <tt>statsd_host</tt> - the statsD host, defaults to "localhost", respects +STATSD_HOST+ env variable
# * <tt>statsd_port</tt> - the statsD port, defaults to 8125, respects +STATSD_PORT+ env variable
# * <tt>reporter</tt> - custom reporter class, defaults to `Datadog::Notifications::Reporter`
def self.configure(&block)
if instance.instance_variable_defined?(:@reporter)
- warn "#{self.name} cannot be reconfigured once it has subscribed to notifications, called from: #{caller[1]}"
+ warn "#{name} cannot be reconfigured once it has subscribed to notifications, called from: #{caller(2..2).first}"
return
end
block.call instance.config if block
end
@@ -60,12 +60,12 @@
def initialize
@config = Config.new
end
- def subscribe(pattern, &block)
+ def subscribe(pattern)
ActiveSupport::Notifications.subscribe(pattern) do |*args|
- block.call reporter, ActiveSupport::Notifications::Event.new(*args)
+ yield reporter, ActiveSupport::Notifications::Event.new(*args)
end
end
def reporter
@reporter ||= config.send(:connect!)