[Seaside] Entry and Re-Entry from Legacy Rails App

Ken Treis ken at miriamtech.com
Tue Feb 20 20:21:33 UTC 2007

On Feb 18, 2007, at 11:19 AM, Giles Bowkett wrote:

> By the way I'd definitely be interested to see the Marshall-reading
> stuff. I'm using Squeak, so I'll be able to test its portability
> pretty quickly.

OK, here it is. I attached it as a VisualWorks 3.0 fileout. Let me  
know if this doesn't work for you, and I can try the "dangerous"  
squeak fileout goodie.

I've been able to use this to load all of the file-serialized Rails  
sessions I can easily get my hands on, and it is able to handle them  

Here's the class comment from RubyMarshal:


RubyMarshal is an implementation of the Ruby built-in "Marshal"  
class. Based in part on marshal.c from the Ruby 1.8.5 codebase.

Booleans, Strings, Symbols, Numbers, Arrays, and Hashes are returned  
as equivalent Smalltalk objects. Class names are returned as symbols.  
All other objects are returned as instances of RubyObject.

Things that aren't supported:

* The internal Ruby "DATA" type, which is used for wrapped C pointers
* Options for Regexps (the flags that follow the final slash, e.g.  
the $i from /$foo/i. We just return regexps as their inner strings  
anyway (see below).


* Regexps are returned as strings that do *not* include leading and  
trailing slashes.

* User-marshaled classes (classes that define _dump and _load or use  
the old marshal_dump/marshal_load protocol) are supported, but their  
raw dump data is the only thing we know how to load. This raw data is  
accessible as RubyObject>>marshalData.

* Hashes with default values (defined like: "Hash.new(5)") are  
supported, but returned as a Dictionary. The default value is stored  
under the key #rubyDefault.

* Floats include some information about the size of the mantissa, but  
we discard that and let Smalltalk handle it. This seems to work, but  
I make no guarantees.

* Some old Modules were serialized as classes. I don't have a test  
for this (MODULE_OLD), but the code should work.

* When particular instances have been extended (like "obj.extend 
(Module)"), we read the module name but throw it away.

There are undoubtedly some edge cases that I missed. If you find one  
of these, send it to me and I'll figure out what we're missing.

Ken Treis
Miriam Technologies, Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RubyMarshal.st
Type: application/octet-stream
Size: 19132 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070220/5d57ab3f/RubyMarshal-0001.obj
-------------- next part --------------

More information about the Seaside mailing list