summaryrefslogtreecommitdiff
path: root/sample/marshal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/marshal.rb')
-rw-r--r--sample/marshal.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/sample/marshal.rb b/sample/marshal.rb
new file mode 100644
index 0000000000..3d399ffe68
--- /dev/null
+++ b/sample/marshal.rb
@@ -0,0 +1,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