Module: OCG::Copyable
Constant Summary collapse
- VARIABLES_TO_COPY =
[].freeze
Instance Method Summary collapse
Instance Method Details
#initialize_copy(source) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/ocg/copyable.rb', line 8 def initialize_copy(source) self.class::VARIABLES_TO_COPY.each do |variable| key = "@#{variable}".to_sym value = source.instance_variable_get key instance_variable_set key, value.dup end end |