Module: Rake::Cloneable
Overview
Mixin for creating easily cloned objects.
Instance Method Summary collapse
-
#clone ⇒ Object
(also: #dup)
Clone an object by making a new object and setting all the instance variables to the same values.
Instance Method Details
#clone ⇒ Object Also known as: dup
Clone an object by making a new object and setting all the instance variables to the same values.
270 271 272 273 274 275 276 277 |
# File 'lib/rake.rb', line 270 def clone sibling = self.class.new instance_variables.each do |ivar| value = self.instance_variable_get(ivar) sibling.instance_variable_set(ivar, value.rake_dup) end sibling end |