Class: Neo4j::ActiveNode::Scope::ScopeRegistry
- Inherits:
-
Object
- Object
- Neo4j::ActiveNode::Scope::ScopeRegistry
- Extended by:
- ActiveSupport::PerThreadRegistry
- Defined in:
- lib/neo4j/active_node/scope.rb
Overview
Constant Summary collapse
- VALID_SCOPE_TYPES =
[:current_scope, :ignore_default_scope]
Instance Method Summary collapse
-
#initialize ⇒ ScopeRegistry
constructor
A new instance of ScopeRegistry.
-
#set_value_for(scope_type, variable_name, value) ⇒ Object
Sets the
valuefor a givenscope_typeandvariable_name. -
#value_for(scope_type, variable_name) ⇒ Object
Obtains the value for a given
scope_nameandvariable_name.
Methods included from ActiveSupport::PerThreadRegistry
Constructor Details
#initialize ⇒ ScopeRegistry
121 122 123 |
# File 'lib/neo4j/active_node/scope.rb', line 121 def initialize @registry = Hash.new { |hash, key| hash[key] = {} } end |
Instance Method Details
#set_value_for(scope_type, variable_name, value) ⇒ Object
Sets the value for a given scope_type and variable_name.
132 133 134 135 |
# File 'lib/neo4j/active_node/scope.rb', line 132 def set_value_for(scope_type, variable_name, value) raise_invalid_scope_type!(scope_type) @registry[scope_type][variable_name] = value end |
#value_for(scope_type, variable_name) ⇒ Object
Obtains the value for a given scope_name and variable_name.
126 127 128 129 |
# File 'lib/neo4j/active_node/scope.rb', line 126 def value_for(scope_type, variable_name) raise_invalid_scope_type!(scope_type) @registry[scope_type][variable_name] end |