Module: Aliyun::Log::PerThreadRegistry

Included in:
ScopeRegistry
Defined in:
lib/aliyun/log/record/scope_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 (private)



16
17
18
19
20
# File 'lib/aliyun/log/record/scope_registry.rb', line 16

def method_missing(name, *args, &block)
  singleton_class.delegate name, to: :instance

  send(name, *args, &block)
end

Class Method Details

.extended(object) ⇒ Object



6
7
8
# File 'lib/aliyun/log/record/scope_registry.rb', line 6

def self.extended(object)
  object.instance_variable_set '@per_thread_registry_key', object.name.freeze
end

Instance Method Details

#instanceObject



10
11
12
# File 'lib/aliyun/log/record/scope_registry.rb', line 10

def instance
  Thread.current[@per_thread_registry_key] ||= new
end