Class: Spyke::ScopeRegistry
- Inherits:
-
Object
- Object
- Spyke::ScopeRegistry
- Extended by:
- ActiveSupport::PerThreadRegistry
- Defined in:
- lib/spyke/scope_registry.rb
Instance Attribute Summary collapse
-
#registry ⇒ Object
Returns the value of attribute registry.
Instance Method Summary collapse
-
#initialize ⇒ ScopeRegistry
constructor
A new instance of ScopeRegistry.
- #set_value_for(scope_type, variable_name, value) ⇒ Object
- #value_for(scope_type, variable_name) ⇒ Object
Constructor Details
#initialize ⇒ ScopeRegistry
Returns a new instance of ScopeRegistry.
16 17 18 |
# File 'lib/spyke/scope_registry.rb', line 16 def initialize self.registry ||= Hash.new { |hash, key| hash[key] = {} } end |
Instance Attribute Details
#registry ⇒ Object
Returns the value of attribute registry.
13 14 15 |
# File 'lib/spyke/scope_registry.rb', line 13 def registry @registry end |
Instance Method Details
#set_value_for(scope_type, variable_name, value) ⇒ Object
24 25 26 |
# File 'lib/spyke/scope_registry.rb', line 24 def set_value_for(scope_type, variable_name, value) registry[scope_type][variable_name] = value end |
#value_for(scope_type, variable_name) ⇒ Object
20 21 22 |
# File 'lib/spyke/scope_registry.rb', line 20 def value_for(scope_type, variable_name) registry[scope_type][variable_name] end |