Class: Aliyun::Log::ScopeRegistry
- Inherits:
-
Object
- Object
- Aliyun::Log::ScopeRegistry
- Extended by:
- PerThreadRegistry
- Defined in:
- lib/aliyun/log/record/scope_registry.rb
Instance Method Summary collapse
-
#initialize ⇒ ScopeRegistry
constructor
A new instance of ScopeRegistry.
-
#set_value_for(scope_type, model, value) ⇒ Object
Sets the
value
for a givenscope_type
andmodel
. - #value_for(scope_type, model) ⇒ Object
Methods included from PerThreadRegistry
Constructor Details
#initialize ⇒ ScopeRegistry
Returns a new instance of ScopeRegistry.
26 27 28 |
# File 'lib/aliyun/log/record/scope_registry.rb', line 26 def initialize @registry = Hash.new { |hash, key| hash[key] = {} } end |
Instance Method Details
#set_value_for(scope_type, model, value) ⇒ Object
Sets the value
for a given scope_type
and model
.
35 36 37 |
# File 'lib/aliyun/log/record/scope_registry.rb', line 35 def set_value_for(scope_type, model, value) @registry[scope_type][model.name] = value end |
#value_for(scope_type, model) ⇒ Object
30 31 32 |
# File 'lib/aliyun/log/record/scope_registry.rb', line 30 def value_for(scope_type, model) @registry[scope_type][model.name] end |