Class: TraceViz::Context::Manager
- Inherits:
-
Object
- Object
- TraceViz::Context::Manager
- Defined in:
- lib/trace_viz/context/manager.rb
Class Method Summary collapse
- .enter_contexts(contexts) ⇒ Object
- .exit_contexts(*keys) ⇒ Object
- .fetch_context(key) ⇒ Object
- .with_contexts(contexts = {}) ⇒ Object
Class Method Details
.enter_contexts(contexts) ⇒ Object
12 13 14 |
# File 'lib/trace_viz/context/manager.rb', line 12 def enter_contexts(contexts) @map.replace(Registry.build(contexts)) end |
.exit_contexts(*keys) ⇒ Object
16 17 18 |
# File 'lib/trace_viz/context/manager.rb', line 16 def exit_contexts(*keys) @map.remove(*keys) end |
.fetch_context(key) ⇒ Object
27 28 29 |
# File 'lib/trace_viz/context/manager.rb', line 27 def fetch_context(key) @map.fetch(key) end |
.with_contexts(contexts = {}) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/trace_viz/context/manager.rb', line 20 def with_contexts(contexts = {}) enter_contexts(contexts) yield ensure exit_contexts(*contexts.keys) end |