class Stripe::Instrumentation
Constants
- RequestEvent
Event
emitted on `request_end` callback.
Public Class Methods
any_subscribers?(topic)
click to toggle source
Returns true if there are a non-zero number of subscribers on the given topic, and false otherwise.
# File lib/stripe/instrumentation.rb, line 62 def self.any_subscribers?(topic) !subscribers[topic].empty? end
notify(topic, event)
click to toggle source
# File lib/stripe/instrumentation.rb, line 75 def self.notify(topic, event) subscribers[topic].each_value { |subscriber| subscriber.call(event) } end
subscribe(topic, name = rand, &block)
click to toggle source
# File lib/stripe/instrumentation.rb, line 66 def self.subscribe(topic, name = rand, &block) subscribers[topic][name] = block name end
unsubscribe(topic, name)
click to toggle source
# File lib/stripe/instrumentation.rb, line 71 def self.unsubscribe(topic, name) subscribers[topic].delete(name) end
Private Class Methods
subscribers()
click to toggle source
# File lib/stripe/instrumentation.rb, line 79 def self.subscribers @subscribers ||= Hash.new { |hash, key| hash[key] = {} } end