Module | Rake::Cloneable |
In: |
lib/rake.rb
|
Clone an object by making a new object and setting all the instance variables to the same values.
# File lib/rake.rb, line 281 281: def clone 282: sibling = self.class.new 283: instance_variables.each do |ivar| 284: value = self.instance_variable_get(ivar) 285: new_value = value.clone rescue value 286: sibling.instance_variable_set(ivar, new_value) 287: end 288: sibling 289: end