Module: Rake::Cloneable
- Defined in:
- lib/rake.rb
Overview
Mixin for creating easily cloned objects.
Instance Method Summary (collapse)
- - (Object) clone
-
- (Object) dup
Clone an object by making a new object and setting all the instance variables to the same values.
Instance Method Details
- (Object) clone
300 301 302 303 304 |
# File 'lib/rake.rb', line 300 def clone sibling = dup sibling.freeze if frozen? sibling end |
- (Object) dup
Clone an object by making a new object and setting all the instance variables to the same values.
289 290 291 292 293 294 295 296 297 298 |
# File 'lib/rake.rb', line 289 def dup sibling = self.class.new instance_variables.each do |ivar| value = self.instance_variable_get(ivar) new_value = value.clone rescue value sibling.instance_variable_set(ivar, new_value) end sibling.taint if tainted? sibling end |