lib/openwfe/utils.rb in openwferu-0.9.8 vs lib/openwfe/utils.rb in openwferu-0.9.9

- old
+ new

@@ -37,10 +37,11 @@ # "hecho en Costa Rica" and "made in Japan" # # john.mettraux@openwfe.org # +require 'rexml/document' require 'tmpdir' require 'open-uri' module OpenWFE @@ -95,10 +96,18 @@ return object.dup end # + # see + # http://wiki.rubygarden.org/Ruby/page/show/Make_A_Deep_Copy_Of_An_Object + # + def OpenWFE.deep_clone (object) + Marshal::load(Marshal.dump(object)) + end + + # # an automatic dup implementation attempt # def OpenWFE.fulldup (object) return nil if object == nil @@ -107,9 +116,13 @@ return object if object.kind_of? Fixnum return object if object.kind_of? TrueClass return object if object.kind_of? FalseClass return object.dup if object.kind_of? String + + #return deep_clone(object) if object.kind_of? REXML::Document + return REXML::Document.new(object.to_s) \ + if object.kind_of? REXML::Document o = object.class.new # # some kind of collection ?