From: "Peña, Botp" Date: 2008-08-20T13:34:38+09:00 Subject: Re: Marshaling an object destroys dynamically created methods From: Patrick Li [mailto:patrickli_2001@hotmail.com] # I noticed this this afternoon: # Unmarshaling a marshaled object, makes all dynamically created methods # private. check your ruby version, pls class MyPage def initialize MyPage.class_eval do def print puts @a end end end end #=> nil #Test the class page = MyPage.new #=> # page.print #prints nil nil #=> nil #Marshal the object File.open("object.obj","w") do |f| Marshal.dump(page, f) end #=> # #UnMarshal the object, and try printing again page = nil #=> nil File.open("object.obj","r") do |f| page = Marshal.load(f) end #=> # page.print nil #=> nil [RUBY_VERSION,RUBY_PATCHLEVEL,RUBY_RELEASE_DATE,RUBY_PLATFORM] #=> ["1.8.6", 286, "2008-08-08", "i386-mswin32"] kind regards -botp