Mixin for creating easily cloned objects.
Methods
Public Instance methods
[ show source ]
# File lib/rake.rb, line 302 302: def clone 303: sibling = dup 304: sibling.freeze if frozen? 305: sibling 306: end
Clone an object by making a new object and setting all the instance variables to the same values.
[ show source ]
# File lib/rake.rb, line 291 291: def dup 292: sibling = self.class.new 293: instance_variables.each do |ivar| 294: value = self.instance_variable_get(ivar) 295: new_value = value.clone rescue value 296: sibling.instance_variable_set(ivar, new_value) 297: end 298: sibling.taint if tainted? 299: sibling 300: end