Module: Mumukit::Platform::Global
- Included in:
- Course, Organization
- Defined in:
- lib/mumukit/platform/global.rb
Instance Method Summary collapse
Instance Method Details
#current ⇒ Object
11 12 13 |
# File 'lib/mumukit/platform/global.rb', line 11 def current Thread.current[__global_thread_variable_key__] || raise("#{__global_thread_variable_key__} not selected") end |
#current? ⇒ Boolean
15 16 17 |
# File 'lib/mumukit/platform/global.rb', line 15 def current? !!Thread.current[__global_thread_variable_key__] end |
#leave! ⇒ Object
7 8 9 |
# File 'lib/mumukit/platform/global.rb', line 7 def leave! Thread.current[__global_thread_variable_key__] = nil end |
#switch!(global) ⇒ Object
2 3 4 5 |
# File 'lib/mumukit/platform/global.rb', line 2 def switch!(global) raise "#{__global_thread_variable_key__} must not be nil" unless global Thread.current[__global_thread_variable_key__] = global end |