<br>Is it possible to use Marshal with wxruby classes to serialize an application's state?<br><br>I tried a minimal example of simply serializing a minimal frame object, and I get the error "no marshal_dump is defined for class MinimalFrame".
<br><br>I don't fully understand this because I also tried another minimal example of dumping a class which did not defined a marshal_dump, and it worked fine. Is there some reason this has been disabled in wxruby classes? Sorry, I picked up ruby a few days ago so I may be missing something obvious.
<br><br>Here's a test program showing that the simple class will serialize but the simple frame will not.<br><br>#!/usr/bin/env ruby<br><br>require 'wx'<br>include Wx<br><br>class MinimalClass<br> def initialize
<br> @data = 1234<br> end<br><br> def save<br> File.open("dump-class","w+") do |f|<br> Marshal.dump(self, f)<br> end<br> end<br><br>end<br><br>class MinimalFrame < Frame<br> def initialize(title)
<br> # The main application frame has no parent (nil)<br> super(nil, :title => title, :size => [ 700, 400 ])<br> @data = 1234<br> end<br><br> def save<br> File.open("dump-frame","w+") do |f|
<br> Marshal.dump(self, f)<br> end<br> end<br><br>end<br><br><br>App.run do<br><br> obj = MinimalClass.new<br> obj.save<br><br> self.app_name = 'Minimal'<br> frame = MinimalFrame.new("Minimal wxRuby App")
<br> frame.save<br>end<br><br>