Module: Rake::Cloneable

Included in:
FileList, TaskLib
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/cloneable.rb

Overview

Mixin for creating easily cloned objects.

Instance Method Summary collapse

Instance Method Details

#initialize_copy(source) ⇒ Object

The hook that is invoked by ‘clone’ and ‘dup’ methods.



8
9
10
11
12
13
14
15
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/cloneable.rb', line 8

def initialize_copy(source)
  super
  source.instance_variables.each do |var|
    src_value  = source.instance_variable_get(var)
    value = src_value.clone rescue src_value
    instance_variable_set(var, value)
  end
end