Class: TurboTest::ConstantTracer::EventPublisher
- Inherits:
-
Object
- Object
- TurboTest::ConstantTracer::EventPublisher
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/turbo_test_constant_tracer/event_publisher.rb
Constant Summary collapse
- EVENT =
"proxy_object_method_call"
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
Instance Method Summary collapse
-
#initialize ⇒ EventPublisher
constructor
A new instance of EventPublisher.
- #publish(name, location) ⇒ Object
- #publish_all_events! ⇒ Object
- #publish_events_once! ⇒ Object
- #reset_call_log ⇒ Object
Constructor Details
#initialize ⇒ EventPublisher
Returns a new instance of EventPublisher.
30 31 32 33 |
# File 'lib/turbo_test_constant_tracer/event_publisher.rb', line 30 def initialize @call_log = Concurrent::Map.new @log_all_events = false end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
13 14 15 |
# File 'lib/turbo_test_constant_tracer/event_publisher.rb', line 13 def enabled @enabled end |
Instance Method Details
#publish(name, location) ⇒ Object
47 48 49 50 51 52 |
# 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! ⇒ Object
39 40 41 |
# File 'lib/turbo_test_constant_tracer/event_publisher.rb', line 39 def publish_all_events! @log_all_events = true end |
#publish_events_once! ⇒ Object
43 44 45 |
# File 'lib/turbo_test_constant_tracer/event_publisher.rb', line 43 def publish_events_once! @log_all_events = false end |
#reset_call_log ⇒ Object
35 36 37 |
# File 'lib/turbo_test_constant_tracer/event_publisher.rb', line 35 def reset_call_log @call_log.clear end |