Module: Flows::Util::InheritableSingletonVars::IsolationStrategy::Migrator Private

Defined in:
lib/flows/util/inheritable_singleton_vars/isolation_strategy.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.4.0

Class Method Summary collapse

Class Method Details

.call(from, to) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.4.0



20
21
22
23
24
25
26
27
28
29
# File 'lib/flows/util/inheritable_singleton_vars/isolation_strategy.rb', line 20

def self.call(from, to)
  parent_var_map = from.instance_variable_get(VAR_MAP_VAR_NAME)
  child_var_map = to.instance_variable_get(VAR_MAP_VAR_NAME) || {}

  to.instance_variable_set(VAR_MAP_VAR_NAME, child_var_map.merge(parent_var_map))

  parent_var_map.each do |name, value_proc|
    to.instance_variable_set(name, value_proc.call)
  end
end