Module: Tomo::Runtime::Current
- Defined in:
- lib/tomo/runtime/current.rb
Class Method Summary collapse
Class Method Details
.host ⇒ Object
7 8 9 |
# File 'lib/tomo/runtime/current.rb', line 7 def host fiber_locals[:host] || remote&.host end |
.remote ⇒ Object
11 12 13 |
# File 'lib/tomo/runtime/current.rb', line 11 def remote fiber_locals[:remote] end |
.task ⇒ Object
15 16 17 |
# File 'lib/tomo/runtime/current.rb', line 15 def task fiber_locals[:task] end |
.variables ⇒ Object
27 28 29 |
# File 'lib/tomo/runtime/current.rb', line 27 def variables fiber_locals.dup.freeze end |
.with(new_locals) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/tomo/runtime/current.rb', line 19 def with(new_locals) old_locals = slice(*new_locals.keys) fiber_locals.merge!(new_locals) yield ensure fiber_locals.merge!(old_locals) end |