Mixin for creating easily cloned objects.
Methods
Public Instance methods
Clone an object by making a new object and setting all the instance variables to the same values.
This method is also aliased as
dup
[ show source ]
# 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
Alias for clone