summaryrefslogtreecommitdiff
path: root/sample/marshal.rb
blob: 3d399ffe688fd3eea2dd5b8050c1373d446d41d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require "marshal"
include Marshal
a = 25.6;
pt = Struct.new('point', :x,:y);
x = pt.new(10, 10)
y = pt.new(20, 20)
rt = Struct.new('rectangle', :origin,:corner);
z = rt.new(x, y)
c = Object.new
s = [a, x, z, c, c, "fff"];
print s.inspect;
d = dumps(s);
print load(d).inspect