Module | Rake::Cloneable |
In: |
lib/rake.rb
|
########################################################################## Mixin for creating easily cloned objects.
Clone an object by making a new object and setting all the instance variables to the same values.
# File lib/rake.rb, line 275 275: def clone 276: sibling = self.class.new 277: instance_variables.each do |ivar| 278: value = self.instance_variable_get(ivar) 279: new_value = value.clone rescue value 280: sibling.instance_variable_set(ivar, new_value) 281: end 282: sibling 283: end