class TurboTest::ConstantTracer::EventPublisher

Constants

EVENT

Attributes

enabled[R]

Public Class Methods

new() click to toggle source
# File lib/turbo_test_constant_tracer/event_publisher.rb, line 30
def initialize
  @call_log = Concurrent::Map.new
  @log_all_events = false
end

Private Class Methods

instance() click to toggle source
# File lib/turbo_test_constant_tracer/event_publisher.rb, line 25
def instance
  @instance || Mutex.new.synchronize { @instance ||= new }
end

Public Instance Methods

publish(name, location) click to toggle source
# File lib/turbo_test_constant_tracer/event_publisher.rb, line 47
def publish(name, location)
  return unless @call_log[name].nil? || @log_all_events == true

  TurboTest::EventRegistry[EVENT].publish(name, location)
  @call_log[name] = true
end
publish_all_events!() click to toggle source
# File lib/turbo_test_constant_tracer/event_publisher.rb, line 39
def publish_all_events!
  @log_all_events = true
end
publish_events_once!() click to toggle source
# File lib/turbo_test_constant_tracer/event_publisher.rb, line 43
def publish_events_once!
  @log_all_events = false
end
reset_call_log() click to toggle source
# File lib/turbo_test_constant_tracer/event_publisher.rb, line 35
def reset_call_log
  @call_log.clear
end