lib/deep_copy.rb in taskjuggler-0.0.5 vs lib/deep_copy.rb in taskjuggler-0.0.6

- old
+ new

@@ -32,10 +32,13 @@ class Object # This is a variant of Object#clone that returns a deep copy of an object. def deep_clone # We can't clone frozen objects. So just return a reference to them. - return self if frozen? + # Built-in classed can't be cloned either. The check below is probably + # cheaper than the frequent (hiddent) exceptions from those objects. + return self if frozen? || nil? || is_a?(Fixnum) || is_a?(Float) || + is_a?(TrueClass) || is_a?(FalseClass) # In case we have loops in our graph, we return references, not # deep-copied objects. if RUBY_VERSION < '1.9.0' return @clonedObject if instance_variables.include?('@clonedObject')