Module: Rake::Cloneable

Included in:
FileList, TaskLib
Defined in:
lib/rake.rb

Overview

Mixin for creating easily cloned objects.

Instance Method Summary collapse

Instance Method Details

#cloneObject Also known as: dup

Clone an object by making a new object and setting all the instance variables to the same values.



270
271
272
273
274
275
276
277
# File 'lib/rake.rb', line 270

def clone
  sibling = self.class.new
  instance_variables.each do |ivar|
    value = self.instance_variable_get(ivar)
    sibling.instance_variable_set(ivar, value.rake_dup)
  end
  sibling
end