Module: PDC::Resource::PerThreadRegistry
- Included in:
- ScopeRegistry
- Defined in:
- lib/pdc/resource/per_thread_registry.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/pdc/resource/per_thread_registry.rb', line 45
def method_missing(name, *args, &block)
singleton_class.delegate name, to: :instance
send(name, *args, &block)
end
|
Class Method Details
.extended(object) ⇒ Object
38
39
40
|
# File 'lib/pdc/resource/per_thread_registry.rb', line 38
def self.extended(object)
object.instance_variable_set '@per_thread_registry_key', object.name.freeze
end
|
Instance Method Details
#instance ⇒ Object
41
42
43
|
# File 'lib/pdc/resource/per_thread_registry.rb', line 41
def instance
Thread.current[@per_thread_registry_key] ||= new
end
|