|
Revision 369, 0.7 kB
(checked in by nakahiro, 7 years ago)
|
Added some samples.
|
- Property svn:eol-style set to
native
- Property svn:executable set to
*
- Property svn:keywords set to
author date id revision
|
| Line | |
|---|
| 1 |
require 'soap/marshal' |
|---|
| 2 |
|
|---|
| 3 |
class Node; include SOAP::Marshallable |
|---|
| 4 |
attr_reader :first, :second |
|---|
| 5 |
|
|---|
| 6 |
def initialize( *initNext ) |
|---|
| 7 |
@first = initNext[0] |
|---|
| 8 |
@second = initNext[1] |
|---|
| 9 |
end |
|---|
| 10 |
end |
|---|
| 11 |
|
|---|
| 12 |
n9 = Node.new |
|---|
| 13 |
n81 = Node.new( n9 ) |
|---|
| 14 |
n82 = Node.new( n9 ) |
|---|
| 15 |
n7 = Node.new( n81, n82 ) |
|---|
| 16 |
n61 = Node.new( n7 ) |
|---|
| 17 |
n62 = Node.new( n7 ) |
|---|
| 18 |
n5 = Node.new( n61, n62 ) |
|---|
| 19 |
n41 = Node.new( n5 ) |
|---|
| 20 |
n42 = Node.new( n5 ) |
|---|
| 21 |
n3 = Node.new( n41, n42 ) |
|---|
| 22 |
n21 = Node.new( n3 ) |
|---|
| 23 |
n22 = Node.new( n3 ) |
|---|
| 24 |
n1 = Node.new( n21, n22 ) |
|---|
| 25 |
|
|---|
| 26 |
marshalledString = SOAP::Marshal.marshal( n1 ) |
|---|
| 27 |
|
|---|
| 28 |
puts marshalledString |
|---|
| 29 |
|
|---|
| 30 |
clonedNode = SOAP::Marshal.unmarshal( marshalledString ) |
|---|
| 31 |
|
|---|
| 32 |
puts clonedNode.inspect |
|---|
| 33 |
|
|---|
| 34 |
p clonedNode.first.first.__id__ |
|---|
| 35 |
p clonedNode.second.first.__id__ |
|---|