Sha256: 4e15fbf016500bc87d6a93dfe5e10e5332ae4fc1ec1e863eaebc4a1d278ff6f5
Contents?: true
Size: 943 Bytes
Versions: 17
Compression:
Stored size: 943 Bytes
Contents
# =========================================================================== # Project: Abbot - SproutCore Build Tools # Copyright: ©2009 Apple Inc. # portions copyright @2006-2009 Sprout Systems, Inc. # and contributors # =========================================================================== module SC # Mixing for creating easily cloned objects. Borrowed from Rake 0.8.3 module Cloneable # Clone an object by making a new object and setting all the instance # variables to the same values. 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 def clone sibling = dup sibling.freeze if frozen? sibling end end end
Version data entries
17 entries across 17 versions & 2 rubygems