Module: Xavier::MutationStrategies::ClassCopy Private
- Defined in:
- lib/xavier/mutation_strategies/class_copy.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.
Copies the class variables from one object to other.
Class Method Summary collapse
-
.copy(from:, to:) ⇒ Array<String>
private
Copies the class variables from one object to other.
Class Method Details
.copy(from:, to:) ⇒ Array<String>
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.
Copies the class variables from one object to other.
15 16 17 18 |
# File 'lib/xavier/mutation_strategies/class_copy.rb', line 15 def self.copy(from:, to:) vars = from.class_variables.map(&:to_s) vars.each { |name| to.class_variable_set(name, from.class_variable_get(name)) } end |