Class: Vernier::ThreadNames
- Inherits:
-
Object
- Object
- Vernier::ThreadNames
- Defined in:
- lib/vernier/thread_names.rb
Overview
Collects names of all seen threads
Instance Method Summary collapse
- #[](object_id) ⇒ Object
- #finish ⇒ Object
-
#initialize ⇒ ThreadNames
constructor
A new instance of ThreadNames.
Constructor Details
#initialize ⇒ ThreadNames
4 5 6 7 8 9 10 |
# File 'lib/vernier/thread_names.rb', line 4 def initialize @names = {} @tp = TracePoint.new(:thread_end) do |e| collect_thread(e.self) end @tp.enable end |
Instance Method Details
#[](object_id) ⇒ Object
12 13 14 |
# File 'lib/vernier/thread_names.rb', line 12 def [](object_id) @names[object_id] || "thread obj_id:#{object_id}" end |
#finish ⇒ Object
16 17 18 19 |
# File 'lib/vernier/thread_names.rb', line 16 def finish collect_running @tp.disable end |