Module: Flows::Util::InheritableSingletonVars::IsolationStrategy
- Defined in:
- lib/flows/util/inheritable_singleton_vars/isolation_strategy.rb
Overview
Strategy which uses procs to generate initial values in target class and children.
This strategy designed to make fully isolated singleton variables between classes.
Can be applied several times to the same class.
Can be applied in the middle of inheritance chain.
Defined Under Namespace
Constant Summary collapse
- VAR_MAP_VAR_NAME =
:@inheritable_vars_with_isolation
Class Method Summary collapse
-
.make_module(vars_with_default = {}) ⇒ Object
Applies behaviour and defaults for singleton variables.
Class Method Details
.make_module(vars_with_default = {}) ⇒ Object
Note:
Variable names should look like :@var
or '@var'
.
Applies behaviour and defaults for singleton variables.
72 73 74 75 76 77 78 |
# File 'lib/flows/util/inheritable_singleton_vars/isolation_strategy.rb', line 72 def make_module(vars_with_default = {}) Module.new.tap do |mod| mod.instance_variable_set(VAR_MAP_VAR_NAME, vars_with_default.dup) init_vars(mod, vars_with_default) mod.extend Injector end end |