| Module | Rake::Cloneable |
| In: |
lib/rake.rb
|
########################################################################## Mixin for creating easily cloned objects.
# File lib/rake.rb, line 304
304: def clone
305: sibling = dup
306: sibling.freeze if frozen?
307: sibling
308: end
Clone an object by making a new object and setting all the instance variables to the same values.
# File lib/rake.rb, line 293
293: def dup
294: sibling = self.class.new
295: instance_variables.each do |ivar|
296: value = self.instance_variable_get(ivar)
297: new_value = value.clone rescue value
298: sibling.instance_variable_set(ivar, new_value)
299: end
300: sibling.taint if tainted?
301: sibling
302: end