lib/cocoapods-binary/tool/tool.rb in cocoapods-binary-0.1.2 vs lib/cocoapods-binary/tool/tool.rb in cocoapods-binary-0.2

- old
+ new

@@ -7,6 +7,30 @@ # end # ``` # def class_attr_accessor(symbol) self.class.send(:attr_accessor, symbol) +end + + + +class Object + def deep_clone + return @deep_cloning_obj if @deep_cloning + @deep_cloning_obj = clone + @deep_cloning_obj.instance_variables.each do |var| + val = @deep_cloning_obj.instance_variable_get(var) + begin + @deep_cloning = true + val = val.deep_clone + rescue TypeError + next + ensure + @deep_cloning = false + end + @deep_cloning_obj.instance_variable_set(var, val) + end + deep_cloning_obj = @deep_cloning_obj + @deep_cloning_obj = nil + deep_cloning_obj + end end \ No newline at end of file