|
Revision 840, 2.0 kB
(checked in by nahi, 5 years ago)
|
Add tests.
|
- Property svn:eol-style set to
native
- Property svn:executable set to
*
- Property svn:keywords set to
author date id revision
|
| Line | |
|---|
| 1 |
module CMarshal |
|---|
| 2 |
class << self |
|---|
| 3 |
public |
|---|
| 4 |
def ruby |
|---|
| 5 |
class << self |
|---|
| 6 |
def dump(o) |
|---|
| 7 |
Marshal.dump(o) |
|---|
| 8 |
end |
|---|
| 9 |
|
|---|
| 10 |
def load(o) |
|---|
| 11 |
Marshal.load(o) |
|---|
| 12 |
end |
|---|
| 13 |
end |
|---|
| 14 |
end |
|---|
| 15 |
|
|---|
| 16 |
def amarshal |
|---|
| 17 |
require 'amarshal' |
|---|
| 18 |
class << self |
|---|
| 19 |
def dump(o) |
|---|
| 20 |
AMarshal.dump(o) |
|---|
| 21 |
end |
|---|
| 22 |
|
|---|
| 23 |
def load(o) |
|---|
| 24 |
AMarshal.load(o) |
|---|
| 25 |
end |
|---|
| 26 |
end |
|---|
| 27 |
end |
|---|
| 28 |
|
|---|
| 29 |
def to_src |
|---|
| 30 |
require 'to_src' |
|---|
| 31 |
ToSrc.independent(false) |
|---|
| 32 |
class << self |
|---|
| 33 |
def dump(o) |
|---|
| 34 |
ToSrc.reset |
|---|
| 35 |
o.to_src |
|---|
| 36 |
end |
|---|
| 37 |
|
|---|
| 38 |
def load(o) |
|---|
| 39 |
eval(o) |
|---|
| 40 |
end |
|---|
| 41 |
end |
|---|
| 42 |
end |
|---|
| 43 |
|
|---|
| 44 |
def to_source |
|---|
| 45 |
require 'ToSource' |
|---|
| 46 |
class << self |
|---|
| 47 |
def dump(o) |
|---|
| 48 |
o.to_source |
|---|
| 49 |
end |
|---|
| 50 |
|
|---|
| 51 |
def load(o) |
|---|
| 52 |
eval(o) |
|---|
| 53 |
end |
|---|
| 54 |
end |
|---|
| 55 |
end |
|---|
| 56 |
|
|---|
| 57 |
class ClXmlSerialContainer |
|---|
| 58 |
attr_accessor :var |
|---|
| 59 |
end |
|---|
| 60 |
|
|---|
| 61 |
def clxmlserial |
|---|
| 62 |
require 'cl/xmlserial' |
|---|
| 63 |
ClXmlSerialContainer.instance_eval { include XmlSerialization } |
|---|
| 64 |
class << self |
|---|
| 65 |
def dump(o) |
|---|
| 66 |
c = ClXmlSerialContainer.new |
|---|
| 67 |
c.var = o |
|---|
| 68 |
c.to_xml |
|---|
| 69 |
end |
|---|
| 70 |
|
|---|
| 71 |
def load(o) |
|---|
| 72 |
ClXmlSerialContainer.from_xml(o).var |
|---|
| 73 |
end |
|---|
| 74 |
end |
|---|
| 75 |
end |
|---|
| 76 |
|
|---|
| 77 |
def soap4r |
|---|
| 78 |
require 'soap/marshal' |
|---|
| 79 |
class << self |
|---|
| 80 |
def dump(o) |
|---|
| 81 |
SOAP::Marshal.dump(o) |
|---|
| 82 |
end |
|---|
| 83 |
|
|---|
| 84 |
def load(o) |
|---|
| 85 |
SOAP::Marshal.load(o) |
|---|
| 86 |
end |
|---|
| 87 |
end |
|---|
| 88 |
end |
|---|
| 89 |
|
|---|
| 90 |
def xmarshal |
|---|
| 91 |
require 'xmarshal' |
|---|
| 92 |
class << self |
|---|
| 93 |
def dump(o) |
|---|
| 94 |
XMarshal.dump(o) |
|---|
| 95 |
end |
|---|
| 96 |
|
|---|
| 97 |
def load(o) |
|---|
| 98 |
XMarshal.load(o) |
|---|
| 99 |
end |
|---|
| 100 |
end |
|---|
| 101 |
end |
|---|
| 102 |
|
|---|
| 103 |
def xmlrpc |
|---|
| 104 |
require 'xmlrpc/marshal' |
|---|
| 105 |
class << self |
|---|
| 106 |
def dump(o) |
|---|
| 107 |
XMLRPC::Marshal.dump(o) |
|---|
| 108 |
end |
|---|
| 109 |
|
|---|
| 110 |
def load(o) |
|---|
| 111 |
XMLRPC::Marshal.load(o) |
|---|
| 112 |
end |
|---|
| 113 |
end |
|---|
| 114 |
end |
|---|
| 115 |
|
|---|
| 116 |
def tmarshal |
|---|
| 117 |
require 'tmarshal' |
|---|
| 118 |
class << self |
|---|
| 119 |
def dump(o) |
|---|
| 120 |
TMarshal.dump(o) |
|---|
| 121 |
end |
|---|
| 122 |
|
|---|
| 123 |
def load(o) |
|---|
| 124 |
TMarshal.restore(o) |
|---|
| 125 |
end |
|---|
| 126 |
end |
|---|
| 127 |
end |
|---|
| 128 |
|
|---|
| 129 |
def yaml |
|---|
| 130 |
require 'yaml' |
|---|
| 131 |
class << self |
|---|
| 132 |
def dump(o) |
|---|
| 133 |
o.to_yaml |
|---|
| 134 |
end |
|---|
| 135 |
|
|---|
| 136 |
def load(o) |
|---|
| 137 |
YAML.load(o) |
|---|
| 138 |
end |
|---|
| 139 |
end |
|---|
| 140 |
end |
|---|
| 141 |
end |
|---|
| 142 |
end |
|---|